mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 16:37:28 +00:00
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:
parent
b9f6712d77
commit
144f59abdd
@ -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
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
@ -40,6 +40,9 @@ public:
|
||||
|
||||
///
|
||||
~Menu();
|
||||
|
||||
/// QMenu::clear() reimplementation to handle the deletion of submenus.
|
||||
void clear();
|
||||
|
||||
private Q_SLOTS:
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user