[vlc-commits] Qt: PopupMenu: Stop crashing on VOut update. (fix #7016)

Francois Cartegnie git at videolan.org
Tue Jun 26 17:24:20 CEST 2012


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 26 17:20:44 2012 +0200| [e5462dbd3a789e15278afd642833788a8a491724] | committer: Francois Cartegnie

Qt: PopupMenu: Stop crashing on VOut update. (fix #7016)

When calling a modal dialog, Qt switches to a new event loop.
The call may still have some event to process in its own queue,
and deleting it when doing the Vout update will have those events
refering to a no longer existing widget.

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

 modules/gui/qt4/menus.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 18bb5ca..3969de1 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -769,7 +769,8 @@ QMenu *VLCMenuBar::HelpMenu( QWidget *parent )
  *****************************************************************************/
 #define POPUP_BOILERPLATE \
     static QMenu* menu = NULL;  \
-    delete menu; menu = NULL; \
+    if ( menu ) menu->deleteLater(); \ /* Ensure it is deleted after processing events */
+    menu = NULL; \                     /* or we might crash on an incoming mouseup event */
     if( !show ) \
         return; \
     QVector<vlc_object_t *> objects; \



More information about the vlc-commits mailing list