Fix memory leak: submenus were never deleted because QMenu::clear() only deletes the QActions

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39299 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2011-07-14 11:10:13 +00:00
parent b9f6712d77
commit 144f59abdd
2 changed files with 14 additions and 0 deletions

View File

@ -1631,6 +1631,17 @@ void Menu::updateView()
}
void Menu::clear()
{
QList<QAction *> items = actions();
for (int i = 0; i != items.size(); ++i) {
// QAction::menu() returns 0 if there's no submenu.
delete items.at(i)->menu();
}
QMenu::clear();
}
/////////////////////////////////////////////////////////////////////
// Menus::Impl definition and implementation
/////////////////////////////////////////////////////////////////////

View File

@ -40,6 +40,9 @@ public:
///
~Menu();
/// QMenu::clear() reimplementation to handle the deletion of submenus.
void clear();
private Q_SLOTS:
///