forked from qt-creator/qt-creator
PluginManager: Introduce global future synchronizer
The global synchronizer will be destructed after the asynchronous shutdown phase and prior to deleting all the plugins (i.e. synchronously). It's assumed that between deleting the synchronizer and the point when all plugin destructors are finished no new futures are added to the global future synchronizer. Change-Id: Ibc839b04f2c2bbd35980b8baed51b29c2c4f7c76 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include <utils/benchmarker.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/futuresynchronizer.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/mimeutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -422,6 +423,11 @@ QString PluginManager::systemInformation()
|
||||
return result;
|
||||
}
|
||||
|
||||
static FutureSynchronizer *futureSynchronizer()
|
||||
{
|
||||
return d->m_futureSynchronizer.get();
|
||||
}
|
||||
|
||||
/*!
|
||||
The list of paths were the plugin manager searches for plugins.
|
||||
|
||||
@@ -976,6 +982,8 @@ void PluginManagerPrivate::nextDelayedInitialize()
|
||||
PluginManagerPrivate::PluginManagerPrivate(PluginManager *pluginManager) :
|
||||
q(pluginManager)
|
||||
{
|
||||
m_futureSynchronizer.reset(new FutureSynchronizer);
|
||||
m_futureSynchronizer->setCancelOnWait(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1043,6 +1051,7 @@ void PluginManagerPrivate::stopAll()
|
||||
*/
|
||||
void PluginManagerPrivate::deleteAll()
|
||||
{
|
||||
m_futureSynchronizer.reset(); // Synchronize all futures from all plugins
|
||||
Utils::reverseForeach(loadQueue(), [this](PluginSpec *spec) {
|
||||
loadPlugin(spec, PluginSpec::Deleted);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user