From e34877867f46a164e6e0271301370668aa2b395f Mon Sep 17 00:00:00 2001 From: Zhang TingAn Date: Wed, 4 Sep 2024 15:36:10 +0800 Subject: [PATCH] fix: [crash] crash when opening pluginModule by menu action Log: as title --- src/plugins/core/modules/pluginmanagermodule.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/core/modules/pluginmanagermodule.cpp b/src/plugins/core/modules/pluginmanagermodule.cpp index 277dfb88f..a2d77a4d3 100644 --- a/src/plugins/core/modules/pluginmanagermodule.cpp +++ b/src/plugins/core/modules/pluginmanagermodule.cpp @@ -36,7 +36,7 @@ void PluginManagerModule::initialize(Controller *_uiController) mHelp->appendGroup("Help.Group.Plugin"); mHelp->addSeparator("Help.Group.Plugin"); - QAction *aboutPluginAction = new QAction(MWMTA_PLUGINS, this); + QAction *aboutPluginAction = new QAction(MWM_ABOUT_PLUGINS, this); auto cmd = ActionManager::instance()->registerAction(aboutPluginAction, "Help.AboutPlugins"); mHelp->addAction(cmd, "Help.Group.Plugin"); @@ -47,23 +47,23 @@ void PluginManagerModule::initialize(Controller *_uiController) MWMTA_PLUGINS); uiController->addNavigationItem(actionOptionsImpl, Priority::lowest); - std::function detailWidgetCreator = [this]()->AbstractWidget*{ + std::function detailWidgetCreator = [this]() -> AbstractWidget * { if (!pluginsUi) { pluginsUi = new PluginsUi(); - } + } return new AbstractWidget(pluginsUi->getPluginDetailView()); }; - - std::function storeWidgetCreator = [this]()->AbstractWidget*{ + + std::function storeWidgetCreator = [this]() -> AbstractWidget * { if (!pluginsUi) { pluginsUi = new PluginsUi(); - } + } return new AbstractWidget(pluginsUi->getStoreWidget()); }; uiController->registerWidgetCreator("pluginDetail", detailWidgetCreator); uiController->registerWidgetCreator(MWMTA_PLUGINS, storeWidgetCreator); - + uiController->bindWidgetToNavigation(MWMTA_PLUGINS, actionOptionsImpl); QObject::connect(navigationItemAction, &QAction::triggered, this, [this]() { @@ -73,5 +73,5 @@ void PluginManagerModule::initialize(Controller *_uiController) if (windowService) windowService->setDockHeaderName(MWMTA_PLUGINS, tr("Extensions")); }); - QObject::connect(aboutPluginAction, &QAction::triggered, this, [this](){uiController->switchWidgetNavigation(MWM_ABOUT_PLUGINS);}); + QObject::connect(aboutPluginAction, &QAction::triggered, this, [this]() { uiController->switchWidgetNavigation(MWMTA_PLUGINS); }); }