[vlc-commits] Qt: SeekSlider: SeekStyle: fix memleak

Francois Cartegnie git at videolan.org
Mon Feb 11 17:07:11 CET 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Feb 11 16:55:40 2013 +0100| [a863be5909e8ed7dd382ff1d8a69909a0a269f33] | committer: Francois Cartegnie

Qt: SeekSlider: SeekStyle: fix memleak

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a863be5909e8ed7dd382ff1d8a69909a0a269f33
---

 modules/gui/qt4/util/input_slider.cpp |    8 +++++++-
 modules/gui/qt4/util/input_slider.hpp |    3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index d421903..8e21228 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -62,6 +62,7 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static )
     chapters = NULL;
     mHandleLength = -1;
     b_seekable = true;
+    alternativeStyle = NULL;
 
     // prepare some static colors
     QPalette p = palette();
@@ -111,7 +112,10 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static )
 
     /* Use the new/classic style */
     if( !b_classic )
-        setStyle( new SeekStyle );
+    {
+        alternativeStyle = new SeekStyle;
+        setStyle( alternativeStyle );
+    }
 
     /* Init to 0 */
     setPosition( -1.0, 0, 0 );
@@ -135,6 +139,8 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static )
 SeekSlider::~SeekSlider()
 {
     delete chapters;
+    if ( alternativeStyle )
+        delete alternativeStyle;
 }
 
 /***
diff --git a/modules/gui/qt4/util/input_slider.hpp b/modules/gui/qt4/util/input_slider.hpp
index 9bf6436..716777a 100644
--- a/modules/gui/qt4/util/input_slider.hpp
+++ b/modules/gui/qt4/util/input_slider.hpp
@@ -46,6 +46,7 @@ class QTimer;
 class SeekPoints;
 class QPropertyAnimation;
 class QStyleOption;
+class QCommonStyle;
 
 /* Input Slider derived from QSlider */
 class SeekSlider : public QSlider
@@ -96,6 +97,8 @@ private:
     QColor tickpointForeground;
     QColor shadowDark;
     QColor shadowLight;
+    QCommonStyle *alternativeStyle;
+
     /* Handle's animation */
     qreal mHandleOpacity;
     QPropertyAnimation *animHandle;



More information about the vlc-commits mailing list