[vlc-commits] Qt: fix memory leaks

Hannes Domani git at videolan.org
Wed Oct 21 18:16:23 CEST 2015


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

Qt: fix memory leaks

QTreeWidgetItem::setData() doesn't take ownership

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 66c53a282536e79c5e3310279fb2cad88a54b7e5)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 c4e98f7..f850aaf 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 3b32c3a..7be5688 100644
--- a/modules/gui/qt4/components/complete_preferences.hpp
+++ b/modules/gui/qt4/components/complete_preferences.hpp
@@ -42,7 +42,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