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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user