[vlc-commits] commit: Qt: delete submenus when clearing the View menu (Jakob Leben )
git at videolan.org
git at videolan.org
Mon Mar 29 12:56:02 CEST 2010
vlc | branch: master | Jakob Leben <jleben at videolan.org> | Mon Mar 29 12:38:15 2010 +0200| [dc807170b22cd2f02c6d1285347fa64af04ebb0f] | committer: Jakob Leben
Qt: delete submenus when clearing the View menu
Prevent unnecessary memory accumulation when new submenus are
created again and again.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dc807170b22cd2f02c6d1285347fa64af04ebb0f
---
modules/gui/qt4/menus.cpp | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 036d722..51e982f 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -430,7 +430,16 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterface
else
{
menu = current;
- menu->clear();
+ //menu->clear();
+ //HACK menu->clear() does not delete submenus
+ QList<QAction*> actions = menu->actions();
+ foreach( QAction *a, actions )
+ {
+ QMenu *m = a->menu();
+ if( m && m->parent() == menu ) delete m;
+ if( a->parent() == menu ) delete a;
+ else menu->removeAction( a );
+ }
}
MainInterface *mi = _mi ? _mi : p_intf->p_sys->p_mi;
More information about the vlc-commits
mailing list