[vlc-commits] qt4: addons tab: Fix leaks

Hugo Beauzée-Luyssen git at videolan.org
Thu Dec 10 18:24:34 CET 2015


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Dec 10 17:46:49 2015 +0100| [60009ebc2954a09617a92f79671d18b7f9d91258] | committer: Hugo Beauzée-Luyssen

qt4: addons tab: Fix leaks

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

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

diff --git a/modules/gui/qt4/dialogs/plugins.cpp b/modules/gui/qt4/dialogs/plugins.cpp
index 54166a2..d3af829 100644
--- a/modules/gui/qt4/dialogs/plugins.cpp
+++ b/modules/gui/qt4/dialogs/plugins.cpp
@@ -351,7 +351,7 @@ AddonsTab::AddonsTab( intf_thread_t *p_intf_ ) : QVLCFrame( p_intf_ )
     leftPane->layout()->addItem( new QSpacerItem( 0, 10 ) );
 
     QToolButton * button;
-    QSignalMapper *mapper = new QSignalMapper();
+    signalMapper = new QSignalMapper();
     QImage icon( ":/addons/default" );
     QColor vlcorange( 0xEC, 0x83, 0x00 );
 #define ADD_CATEGORY( label, ltooltip, numb ) \
@@ -368,8 +368,8 @@ AddonsTab::AddonsTab( intf_thread_t *p_intf_ ) : QVLCFrame( p_intf_ )
     button->setCheckable( true );\
     if ( numb == -1 ) button->setChecked( true );\
     button->setAutoExclusive( true );\
-    CONNECT( button, clicked(), mapper, map() );\
-    mapper->setMapping( button, numb );\
+    CONNECT( button, clicked(), signalMapper, map() );\
+    signalMapper->setMapping( button, numb );\
     leftPane->layout()->addWidget( button );
 
     ADD_CATEGORY( qtr("All"), qtr("Interface Settings"),
@@ -454,7 +454,7 @@ AddonsTab::AddonsTab( intf_thread_t *p_intf_ ) : QVLCFrame( p_intf_ )
 
     // Model
     AddonsListModel *model = new AddonsListModel( AM, addonsView );
-    addonsModel = new AddonsSortFilterProxyModel();
+    addonsModel = new AddonsSortFilterProxyModel( addonsView );
     addonsModel->setDynamicSortFilter( true );
     addonsModel->setFilterCaseSensitivity( Qt::CaseInsensitive );
     addonsModel->setSortRole( Qt::DisplayRole );
@@ -463,7 +463,7 @@ AddonsTab::AddonsTab( intf_thread_t *p_intf_ ) : QVLCFrame( p_intf_ )
     addonsModel->setFilterRole( Qt::DisplayRole );
     addonsView->setModel( addonsModel );
 
-    CONNECT( mapper, mapped(int), addonsModel, setTypeFilter(int) );
+    CONNECT( signalMapper, mapped(int), addonsModel, setTypeFilter(int) );
 
     CONNECT( searchInput, textChanged( const QString &),
              addonsModel, setFilterFixedString( QString ) );
@@ -490,6 +490,7 @@ AddonsTab::AddonsTab( intf_thread_t *p_intf_ ) : QVLCFrame( p_intf_ )
 AddonsTab::~AddonsTab()
 {
     delete spinnerAnimation;
+    delete signalMapper;
 }
 
 // Do not close on ESC or ENTER
diff --git a/modules/gui/qt4/dialogs/plugins.hpp b/modules/gui/qt4/dialogs/plugins.hpp
index 1da97e3..8f8c017 100644
--- a/modules/gui/qt4/dialogs/plugins.hpp
+++ b/modules/gui/qt4/dialogs/plugins.hpp
@@ -42,6 +42,7 @@ class QTabWidget;
 class QComboBox;
 class QTreeWidget;
 class QLineEdit;
+class QSignalMapper;
 //class QTextBrowser;
 class QListView;
 class QStyleOptionViewItem;
@@ -153,6 +154,7 @@ private:
     /* Wait spinner */
     PixmapAnimator *spinnerAnimation;
     bool b_localdone;
+    QSignalMapper *signalMapper;
 };
 
 class PluginTreeItem : public QTreeWidgetItem



More information about the vlc-commits mailing list