[vlc-commits] qt: fix recentsMenu that causes skins2 to crash
Erwan Tulou
git at videolan.org
Tue Jan 23 13:08:27 CET 2018
vlc/vlc-3.0 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Jan 23 12:15:58 2018 +0100| [e9dd62ed8c55e30b942c5adf3b95c5431073acd1] | committer: Erwan Tulou
qt: fix recentsMenu that causes skins2 to crash
Skins2 uses FileMenu in the PopupMenu (short lifetime). This causes the
static variable recentsMenu to be freed and then be dereferenced.
The patch creates a one-off recentsMenu, that is used by the different
instances of FileMenu via the addMenu function (no transfer of ownership).
It follows the same pattern as the other two static audioDeviceMenu
and rendererMenu. Note that these static variables are never freed.
(cherry picked from commit 2f562a59f9fec7fffb2070d4ab597f933ca1a5f3)
Signed-off-by: Erwan Tulou <erwan10 at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=e9dd62ed8c55e30b942c5adf3b95c5431073acd1
---
modules/gui/qt/menus.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index 77392d611f..0ccf1412eb 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -370,9 +370,11 @@ QMenu *VLCMenuBar::FileMenu( intf_thread_t *p_intf, QWidget *parent, MainInterfa
addDPStaticEntry( menu, qtr( "Open &Location from clipboard" ),
NULL, SLOT( openUrlDialog() ), "Ctrl+V" );
- if( var_InheritBool( p_intf, "qt-recentplay" ) )
+ if( !recentsMenu && var_InheritBool( p_intf, "qt-recentplay" ) )
+ recentsMenu = new QMenu( qtr( "Open &Recent Media" ) );
+
+ if( recentsMenu )
{
- recentsMenu = new QMenu( qtr( "Open &Recent Media" ), menu );
updateRecents( p_intf );
menu->addMenu( recentsMenu );
}
More information about the vlc-commits
mailing list