diff options
author | hjk <hjk@qt.io> | 2018-02-21 10:03:38 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2018-02-23 08:57:49 +0000 |
commit | 31a55b02477fa0c6b9b9fca7e26ebc6951c3be30 (patch) | |
tree | f588d537807b8b54715a834819115aed470b0df4 /tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp | |
parent | 34fec1cad23e2c6fe8ecf907419b231817e27564 (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/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp')
-rw-r--r-- | tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp index 6405c266688..0bb1fc88429 100644 --- a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp @@ -27,22 +27,20 @@ #include <extensionsystem/pluginmanager.h> -#include <qplugin.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; - obj->setObjectName(QLatin1String("MyPlugin1")); - addAutoReleasedObject(obj); + object1 = new QObject(this); + object1->setObjectName(QLatin1String("MyPlugin1")); + ExtensionSystem::PluginManager::addObject(object1); bool found2 = false; bool found3 = false; @@ -70,8 +68,8 @@ void MyPlugin1::extensionsInitialized() if (!initializeCalled) return; // don't do this at home, it's just done here for the test - QObject *obj = new QObject; - obj->setObjectName(QLatin1String("MyPlugin1_running")); - addAutoReleasedObject(obj); + object2 = new QObject(this); + object2->setObjectName(QLatin1String("MyPlugin1_running")); + ExtensionSystem::PluginManager::addObject(object2); } |