diff --git a/src/plugins/helloworld/helloworldplugin.cpp b/src/plugins/helloworld/helloworldplugin.cpp index 79cc6dfb9af..8487e1b0763 100644 --- a/src/plugins/helloworld/helloworldplugin.cpp +++ b/src/plugins/helloworld/helloworldplugin.cpp @@ -75,6 +75,7 @@ HelloWorldPlugin::HelloWorldPlugin() */ HelloWorldPlugin::~HelloWorldPlugin() { + delete m_helloMode; } /*! Initializes the plugin. Returns true on success. @@ -116,10 +117,8 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMe Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); toolsMenu->addMenu(helloWorldMenu); - // Add a mode with a push button based on BaseMode. Like the BaseView, - // it will unregister itself from the plugin manager when it is deleted. - Core::IMode *helloMode = new HelloMode; - addAutoReleasedObject(helloMode); + // Add a mode with a push button based on BaseMode. + m_helloMode = new HelloMode; return true; } diff --git a/src/plugins/helloworld/helloworldplugin.h b/src/plugins/helloworld/helloworldplugin.h index 84924a9409d..8546f4cf566 100644 --- a/src/plugins/helloworld/helloworldplugin.h +++ b/src/plugins/helloworld/helloworldplugin.h @@ -30,6 +30,8 @@ namespace HelloWorld { namespace Internal { +class HelloMode; + class HelloWorldPlugin : public ExtensionSystem::IPlugin { @@ -46,6 +48,8 @@ public: private: void sayHelloWorld(); + + HelloMode *m_helloMode = nullptr; }; } // namespace Internal