[vlc-devel] [PATCH] Fix a bug 'introduced' by 0448c670c32d9f (Qt's popup menu bugfix)
Jean-Philippe André
jpeg at via.ecp.fr
Thu May 29 15:14:58 CEST 2008
Actually, the QMenu was not correctly destroyed: its children were
still alive. See eg. http://dinauz.org/~jpeg/VideoLAN/capture32.png
And, sorry for the vlc_object_find() in last patch, I stupidly copied
some code from the same file. (ivoire fixed that)
---
modules/gui/qt4/menus.cpp | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 696d17b..139eae1 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -673,12 +673,28 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
}
p_intf->p_sys->p_popup_menu->popup( QCursor::pos() );
}
- else
+ else if( p_intf->p_sys->p_popup_menu != NULL )
{
// destroy popup if there is one
+ QAction *p_action, *p_sub_action;
+ QMenu *p_menu;
+ Q_FOREACH( p_action, p_intf->p_sys->p_popup_menu->actions() )
+ {
+ if( p_menu = p_action->menu() )
+ {
+ /* This case should happen only if intf menu is shown */
+ Q_FOREACH( p_sub_action, p_menu->actions() )
+ {
+ if( p_sub_action->menu() )
+ delete p_sub_action->menu();
+ }
+ delete p_menu;
+ }
+ }
delete p_intf->p_sys->p_popup_menu;
p_intf->p_sys->p_popup_menu = NULL;
}
+ // else: Nothing to do
}
/************************************************************************
--
1.5.5.1
More information about the vlc-devel
mailing list