diff options
author | Nikita Baryshnikov <nib952051@gmail.com> | 2015-02-25 00:28:54 +0300 |
---|---|---|
committer | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-03-16 09:13:06 +0000 |
commit | 4b6ee5881a2d7ff327288795959efa6630b11d13 (patch) | |
tree | dddf041b05d3ca5df7a7977bcea6f18da3249df8 /src/libs/extensionsystem/pluginmanager.cpp | |
parent | 954feb48b816e7abe6686443d45d7b5131fedd0d (diff) | |
download | qt-creator-4b6ee5881a2d7ff327288795959efa6630b11d13.tar.gz |
PluginManager: share ExecuteOnDestruction with utils
Change-Id: I895d0ae48c36030e58aea1676873bd285680a661
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'src/libs/extensionsystem/pluginmanager.cpp')
-rw-r--r-- | src/libs/extensionsystem/pluginmanager.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index 5c2fd958d3..5f2785236d 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -52,6 +52,7 @@ #include <QSysInfo> #include <utils/algorithm.h> +#include <utils/executeondestruction.h> #include <utils/qtcassert.h> #ifdef WITH_TESTS @@ -1059,16 +1060,6 @@ static TestPlan generateCustomTestPlan(IPlugin *plugin, const QList<QObject *> & return testPlan; } -class ExecuteOnDestruction -{ -public: - ExecuteOnDestruction(std::function<void()> code) : destructionCode(code) {} - ~ExecuteOnDestruction() { if (destructionCode) destructionCode(); } - -private: - const std::function<void()> destructionCode; -}; - void PluginManagerPrivate::startTests() { if (PluginManager::hasError()) { @@ -1084,7 +1075,8 @@ void PluginManagerPrivate::startTests() continue; // plugin not loaded const QList<QObject *> testObjects = plugin->createTestObjects(); - ExecuteOnDestruction deleteTestObjects([&]() { qDeleteAll(testObjects); }); + Utils::ExecuteOnDestruction deleteTestObjects([&]() { qDeleteAll(testObjects); }); + Q_UNUSED(deleteTestObjects) const bool hasDuplicateTestObjects = testObjects.size() != testObjects.toSet().size(); QTC_ASSERT(!hasDuplicateTestObjects, continue); |