[vlc-devel] commit: Preferences: fix some memleaks and fix horrible video-filter bug. : D (Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Aug 1 20:37:41 CEST 2008


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Aug  1 11:39:00 2008 -0700| [36f0edc98752f8afa17a50cb8de086b30ba54c2e] | committer: Jean-Baptiste Kempf 

Preferences: fix some memleaks and fix horrible video-filter bug. :D

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

 .../gui/qt4/components/complete_preferences.cpp    |    7 +++++++
 .../gui/qt4/components/complete_preferences.hpp    |    2 +-
 modules/gui/qt4/components/preferences_widgets.cpp |    8 +++++---
 modules/gui/qt4/components/simple_preferences.cpp  |   10 +++-------
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/modules/gui/qt4/components/complete_preferences.cpp b/modules/gui/qt4/components/complete_preferences.cpp
index d6cd616..8c68d16 100644
--- a/modules/gui/qt4/components/complete_preferences.cpp
+++ b/modules/gui/qt4/components/complete_preferences.cpp
@@ -518,5 +518,12 @@ void AdvPrefsPanel::apply()
         c->doApply( p_intf );
     }
 }
+
 void AdvPrefsPanel::clean()
 {}
+
+AdvPrefsPanel::~AdvPrefsPanel()
+{
+    qDeleteAll( controls ); controls.clear();
+}
+
diff --git a/modules/gui/qt4/components/complete_preferences.hpp b/modules/gui/qt4/components/complete_preferences.hpp
index 6cde2e1..29105e8 100644
--- a/modules/gui/qt4/components/complete_preferences.hpp
+++ b/modules/gui/qt4/components/complete_preferences.hpp
@@ -85,7 +85,7 @@ class AdvPrefsPanel : public QWidget
 public:
     AdvPrefsPanel( intf_thread_t *, QWidget *, PrefsItemData * );
     AdvPrefsPanel( QWidget *);
-    virtual ~AdvPrefsPanel() {};
+    virtual ~AdvPrefsPanel();
     void apply();
     void clean();
 private:
diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index 2bcffd1..67f1cf8 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -606,8 +606,11 @@ ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this,
         QGridLayout *l, int &line) :
     VStringConfigControl( _p_this, _p_item, _parent )
 {
+    groupBox = NULL;
+    if( !p_item->psz_text ) return;
+
     groupBox = new QGroupBox ( qtr(p_item->psz_text) );
-    text = new QLineEdit();
+    text = new QLineEdit;
     QGridLayout *layoutGroupBox = new QGridLayout( groupBox );
 
     finish( bycat );
@@ -641,8 +644,7 @@ ModuleListConfigControl::~ModuleListConfigControl()
     {
         delete *it;
     }
-    delete groupBox;
-    delete text;
+    if( groupBox ) delete groupBox;
 }
 
 #define CHECKBOX_LISTS \
diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp
index 4c42b43..980b504 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -40,6 +40,8 @@
 #include <QUrl>
 #include <QVBoxLayout>
 
+#include <QtAlgorithms>
+
 #include <string>
 
 #define ICON_HEIGHT 64
@@ -571,13 +573,7 @@ void SPrefsPanel::updateAudioOptions( int number)
 
 SPrefsPanel::~SPrefsPanel()
 {
-    QList<ConfigControl *>::Iterator conf_it;
-    for( conf_it = controls.begin() ; conf_it != controls.end() ; conf_it++ )
-    {
-        ConfigControl *c = qobject_cast<ConfigControl *>(*conf_it);
-        delete c;
-    }
-    controls.clear();
+    qDeleteAll( controls ); controls.clear();
 }
 
 void SPrefsPanel::updateAudioVolume( int volume )




More information about the vlc-devel mailing list