menu: ensure all addMenu() calls are followed with setParent() calls

Ensures memory taken by creating a new menu is freed.
This commit is contained in:
itsmattkc
2020-04-19 01:26:54 +10:00
parent 0c88a146c1
commit f2bff5f150
4 changed files with 99 additions and 64 deletions
+4 -3
View File
@@ -303,14 +303,15 @@ void NodeView::ShowContextMenu(const QPoint &pos)
return;
}
Menu* m = new Menu();
Menu m;
Menu* add_menu = NodeFactory::CreateMenu();
add_menu->setTitle(tr("Add"));
connect(add_menu, &Menu::triggered, this, &NodeView::CreateNodeSlot);
m->addMenu(add_menu);
m.addMenu(add_menu);
add_menu->setParent(&m);
m->exec(mapToGlobal(pos));
m.exec(mapToGlobal(pos));
}
void NodeView::CreateNodeSlot(QAction *action)