[vlc-devel] commit: Qt: kill memleak on the special sound slider (Jean-Baptiste Kempf )

git version control git at videolan.org
Mon Jun 15 09:07:11 CEST 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jun 15 09:01:15 2009 +0200| [d65ad9ba35879a2e154ae5d7329790d28aacc582] | committer: Jean-Baptiste Kempf 

Qt: kill memleak on the special sound slider

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

 modules/gui/qt4/components/controller_widget.cpp |    9 ++++++++-
 modules/gui/qt4/components/controller_widget.hpp |    2 ++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/components/controller_widget.cpp b/modules/gui/qt4/components/controller_widget.cpp
index 23bd550..5276cd8 100644
--- a/modules/gui/qt4/components/controller_widget.cpp
+++ b/modules/gui/qt4/components/controller_widget.cpp
@@ -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 )
diff --git a/modules/gui/qt4/components/controller_widget.hpp b/modules/gui/qt4/components/controller_widget.hpp
index b43c1ae..44e5dee 100644
--- a/modules/gui/qt4/components/controller_widget.hpp
+++ b/modules/gui/qt4/components/controller_widget.hpp
@@ -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 );




More information about the vlc-devel mailing list