[vlc-commits] Qt: fix memory leaks

Hannes Domani git at videolan.org
Mon Jul 6 17:48:24 CEST 2015


vlc | branch: master | Hannes Domani <ssbssa at yahoo.de> | Fri Jul  3 21:42:08 2015 +0200| [66c53a282536e79c5e3310279fb2cad88a54b7e5] | committer: Jean-Baptiste Kempf

Qt: fix memory leaks

QTreeWidgetItem::setData() doesn't take ownership

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt4/components/complete_preferences.cpp |    8 ++++----
 modules/gui/qt4/components/complete_preferences.hpp |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt4/components/complete_preferences.cpp b/modules/gui/qt4/components/complete_preferences.cpp
index 8841b79..d8620b1 100644
--- a/modules/gui/qt4/components/complete_preferences.cpp
+++ b/modules/gui/qt4/components/complete_preferences.cpp
@@ -101,7 +101,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
             if( p_item->value.i == -1 ) break;
 
             /* PrefsItemData Init */
-            data = new PrefsItemData();
+            data = new PrefsItemData( this );
             data->name = qtr( config_CategoryNameGet( p_item->value.i ) );
             psz_help = config_CategoryHelpGet( p_item->value.i );
             if( psz_help )
@@ -167,7 +167,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
             /* Normal Subcategories */
 
             /* Process the Data */
-            data_sub = new PrefsItemData();
+            data_sub = new PrefsItemData( this );
             data_sub->name = qtr( config_CategoryNameGet( p_item->value.i) );
             psz_help = config_CategoryHelpGet( p_item->value.i );
             if( psz_help )
@@ -268,7 +268,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
         }
         if( !b_found ) continue;
 
-        PrefsItemData *module_data = new PrefsItemData();
+        PrefsItemData *module_data = new PrefsItemData( this );
         module_data->i_type = PrefsItemData::TYPE_MODULE;
         module_data->psz_shortcut = strdup( module_get_object( p_module ) );
         module_data->name = qtr( module_get_name( p_module, false ) );
@@ -478,7 +478,7 @@ void PrefsTree::resizeColumns()
     resizeColumnToContents( 0 );
 }
 
-PrefsItemData::PrefsItemData()
+PrefsItemData::PrefsItemData( QObject *_parent ) : QObject( _parent )
 {
     panel = NULL;
     i_object_id = 0;
diff --git a/modules/gui/qt4/components/complete_preferences.hpp b/modules/gui/qt4/components/complete_preferences.hpp
index 90fc0f1..be25c67 100644
--- a/modules/gui/qt4/components/complete_preferences.hpp
+++ b/modules/gui/qt4/components/complete_preferences.hpp
@@ -41,7 +41,7 @@ class PrefsItemData : public QObject
 {
     Q_OBJECT
 public:
-    PrefsItemData();
+    PrefsItemData( QObject * );
     virtual ~PrefsItemData() { free( psz_shortcut ); };
     bool contains( const QString &text, Qt::CaseSensitivity cs );
     AdvPrefsPanel *panel;



More information about the vlc-commits mailing list