1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Plugins: Set plugin as parent for all created actions

This fixes crash on Windows when unloading plugin and then showing a menu
where the plugin action was.

There is still crash on exit in that case.
This commit is contained in:
David Rosca 2015-10-21 14:05:49 +02:00
parent e375a9b520
commit 176b31198e
3 changed files with 5 additions and 3 deletions

View File

@ -116,7 +116,6 @@ void TabManagerPlugin::populateExtensionsMenu(QMenu* menu)
{
if (viewType() == ShowAsWindow) {
QAction* showAction = m_controller->createMenuAction();
showAction->setParent(menu);
showAction->setCheckable(false);
connect(showAction, SIGNAL(triggered()), m_controller, SLOT(raiseTabManager()));
menu->addAction(showAction);

View File

@ -48,7 +48,7 @@ QString TabManagerWidgetController::title() const
QAction* TabManagerWidgetController::createMenuAction()
{
QAction* act = new QAction(tr("Tab Manager"), 0);
QAction* act = new QAction(tr("Tab Manager"), this);
act->setCheckable(true);
act->setIcon(QIcon(":tabmanager/data/tabmanager.png"));
act->setShortcut(QKeySequence("Ctrl+Shift+M"));

View File

@ -34,7 +34,10 @@ QString TestPlugin_Sidebar::title() const
QAction* TestPlugin_Sidebar::createMenuAction()
{
QAction* act = new QAction(tr("Testing Sidebar"), 0);
// The action must be parented to some object from plugin, otherwise
// there may be a crash when unloading the plugin.
QAction* act = new QAction(tr("Testing Sidebar"), this);
act->setCheckable(true);
return act;