aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/pluginview/plugins/plugin1/plugin1.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-02-21 10:03:38 +0100
committerhjk <hjk@qt.io>2018-02-23 08:57:49 +0000
commit31a55b02477fa0c6b9b9fca7e26ebc6951c3be30 (patch)
treef588d537807b8b54715a834819115aed470b0df4 /tests/manual/pluginview/plugins/plugin1/plugin1.cpp
parent34fec1cad23e2c6fe8ecf907419b231817e27564 (diff)
ExtensionSystem: Remove per-plugin object pools
Remove now-unused IPlugin::addAutoReleasedObject and IPlugin:: {add,remove}Object convenience functions that were only forwarding to the global pool. Adjust all related tests. All previous users of these convenience functions are gone, and we do not want to encourage the use of object pool anymore. Plugins that wish to share objects to implement weak dependencies can use the global object pool via ExtensionSystem::PluginManager:: {add,remove}Object directly. Change-Id: Ic668ad5504af76963f6d4c69ae160438efc70db5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'tests/manual/pluginview/plugins/plugin1/plugin1.cpp')
-rw-r--r--tests/manual/pluginview/plugins/plugin1/plugin1.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/tests/manual/pluginview/plugins/plugin1/plugin1.cpp b/tests/manual/pluginview/plugins/plugin1/plugin1.cpp
index f6fd28006b..5308c8147e 100644
--- a/tests/manual/pluginview/plugins/plugin1/plugin1.cpp
+++ b/tests/manual/pluginview/plugins/plugin1/plugin1.cpp
@@ -27,21 +27,20 @@
#include <extensionsystem/pluginmanager.h>
-#include <QObject>
-
using namespace Plugin1;
-MyPlugin1::MyPlugin1()
- : initializeCalled(false)
+MyPlugin1::~MyPlugin1()
{
+ ExtensionSystem::PluginManager::removeObject(object1);
+ ExtensionSystem::PluginManager::removeObject(object2);
}
bool MyPlugin1::initialize(const QStringList & /*arguments*/, QString *errorString)
{
initializeCalled = true;
- QObject *obj = new QObject(this);
- obj->setObjectName("MyPlugin1");
- addAutoReleasedObject(obj);
+ object1 = new QObject(this);
+ object1->setObjectName("MyPlugin1");
+ ExtensionSystem::PluginManager::addObject(object1);
bool found2 = false;
bool found3 = false;
@@ -69,7 +68,7 @@ void MyPlugin1::extensionsInitialized()
if (!initializeCalled)
return;
// don't do this at home, it's just done here for the test
- QObject *obj = new QObject(this);
- obj->setObjectName("MyPlugin1_running");
- addAutoReleasedObject(obj);
+ object2 = new QObject(this);
+ object2->setObjectName("MyPlugin1_running");
+ ExtensionSystem::PluginManager::addObject(object2);
}