]> git.sesse.net Git - vlc/commitdiff
Qt: kill memleak on the special sound slider
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 15 Jun 2009 07:01:15 +0000 (09:01 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 15 Jun 2009 07:07:01 +0000 (09:07 +0200)
modules/gui/qt4/components/controller_widget.cpp
modules/gui/qt4/components/controller_widget.hpp

index 23bd550df4ce12a888627cfed9b788385692bea9..5276cd8acf01d2a0fe8003eb79a6abb0d082ad29 100644 (file)
@@ -62,13 +62,14 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
     if( !b_special )
     {
         volumeMenu = NULL; subLayout = NULL;
+        volumeControlWidget = NULL;
     }
     else
     {
         /* Special view, click on button shows the slider */
         b_shiny = false;
 
-        QFrame *volumeControlWidget = new QFrame;
+        volumeControlWidget = new QFrame;
         subLayout = new QVBoxLayout( volumeControlWidget );
         subLayout->setLayoutMargins( 4, 4, 4, 4, 4 );
         volumeMenu = new QMenu( this );
@@ -121,6 +122,12 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
     CONNECT( THEMIM, volumeChanged( void ), this, updateVolume( void ) );
 }
 
+SoundWidget::~SoundWidget()
+{
+    delete volumeSlider;
+    delete volumeControlWidget;
+}
+
 void SoundWidget::updateVolume( int i_sliderVolume )
 {
     if( !b_my_volume )
index b43c1aeb33c5c7218606750a12d371410b101e8f..44e5deefa2bba5688cff69c65096f53e8767f0a0 100644 (file)
@@ -68,11 +68,13 @@ class SoundWidget : public QWidget
 public:
     SoundWidget( QWidget *parent, intf_thread_t  *_p_i, bool,
                  bool b_special = false );
+    virtual ~SoundWidget();
 
 private:
     intf_thread_t       *p_intf;
     QLabel              *volMuteLabel;
     QAbstractSlider     *volumeSlider;
+    QFrame              *volumeControlWidget;
     bool                 b_my_volume;
     QMenu               *volumeMenu;
     virtual bool eventFilter( QObject *obj, QEvent *e );