[vlc-devel] [PATCH v2 3/3] qt: fix QMenu leaks
Pierre Lamot
pierre at videolabs.io
Fri Oct 27 18:29:44 CEST 2017
QMenu::addMenu(QMenu*) doesn't take ownership of sub menu
---
modules/gui/qt/menus.cpp | 8 ++++----
modules/gui/qt/menus.hpp | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index 663ac2b7e9..8bb9d56f47 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -609,7 +609,7 @@ QMenu *VLCMenuBar::AudioMenu( intf_thread_t *p_intf, QMenu * current )
if( current->isEmpty() )
{
addActionWithSubmenu( current, "audio-es", qtr( "Audio &Track" ) );
- audioDeviceMenu = new QMenu( qtr( "Audio &Device" ) );
+ audioDeviceMenu = new QMenu(qtr( "Audio &Device" ), current );
current->addMenu( audioDeviceMenu );
addActionWithSubmenu( current, "stereo-mode", qtr( "&Stereo Mode" ) );
current->addSeparator();
@@ -667,7 +667,7 @@ QMenu *VLCMenuBar::VideoMenu( intf_thread_t *p_intf, QMenu *current )
addActionWithSubmenu( current, "video-es", qtr( "Video &Track" ) );
current->addSeparator();
- rendererMenu = RendererMenu( p_intf );
+ rendererMenu = RendererMenu( p_intf, current );
current->addMenu( rendererMenu );
current->addSeparator();
@@ -1622,9 +1622,9 @@ void VLCMenuBar::updateRecents( intf_thread_t *p_intf )
}
}
-QMenu *VLCMenuBar::RendererMenu( intf_thread_t *p_intf )
+QMenu *VLCMenuBar::RendererMenu(intf_thread_t *p_intf, QMenu *menu )
{
- QMenu *submenu = new QMenu( qtr("&Renderer") );
+ QMenu *submenu = new QMenu( qtr("&Renderer"), menu );
rendererGroup = new QActionGroup(submenu);
diff --git a/modules/gui/qt/menus.hpp b/modules/gui/qt/menus.hpp
index 16728f54b1..99ea657986 100644
--- a/modules/gui/qt/menus.hpp
+++ b/modules/gui/qt/menus.hpp
@@ -131,7 +131,7 @@ private:
}
static QMenu *HelpMenu( QWidget * );
- static QMenu *RendererMenu( intf_thread_t *p_intf );
+ static QMenu *RendererMenu(intf_thread_t *p_intf , QMenu *menu = NULL );
/* Popups Menus */
static void PopupMenuStaticEntries( QMenu *menu );
--
2.14.2
More information about the vlc-devel
mailing list