[vlc-commits] qt: fix recentsMenu that causes skins2 to crash

Erwan Tulou git at videolan.org
Tue Jan 23 13:06:41 CET 2018


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Jan 23 12:15:58 2018 +0100| [2f562a59f9fec7fffb2070d4ab597f933ca1a5f3] | 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.

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

 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