[vlc-commits] Qt(menu): fix RendererMenu for skins2

Erwan Tulou git at videolan.org
Tue Nov 27 11:33:50 CET 2018


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Mon Nov 26 14:19:33 2018 +0100| [1177a500f55fd5220e3b2524556e5e901ed6e06b] | committer: Erwan Tulou

Qt(menu): fix RendererMenu for skins2

If a menu is given a parent, the menu will transparently be deleted once
the parent is deleted. If the menu is also kept in a static variable,
there is no easy means to reset said variable to NULL when the deletion
does occur. That leaves the likelihood to dereference an invalid pointer.

For the Qt interface, luckily the first parent object is the menu bar
whose lifetime is expected to span the entire vlc session, so the risk
is limited.

For the skins2 interface, on the contrary, the first parent object is a
popupmenu with a very short lifetime. So, it is bound to crash as soon
as a first popupmenu is displayed and closed.

This patch sets a NULL parent.

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

 modules/gui/qt/menus.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index eab268b6db..25f14673c2 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -732,7 +732,7 @@ QMenu *VLCMenuBar::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
     menu->addSeparator();
 
     if ( !VLCMenuBar::rendererMenu )
-        VLCMenuBar::rendererMenu = new RendererMenu( menu, p_intf );
+        VLCMenuBar::rendererMenu = new RendererMenu( NULL, p_intf );
 
     menu->addMenu( VLCMenuBar::rendererMenu );
     menu->addSeparator();



More information about the vlc-commits mailing list