delete plugin loaders from QFactoryLoader

previously deleting the QPluginLoader instances was causing crashses in
gwenview sometimes (e.g. when gif plugin was in use but that plugin is no
more)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-03-23 11:14:45 +02:00
parent 748128b688
commit 1b5ac1c06b

View file

@ -41,6 +41,7 @@ class QFactoryLoaderPrivate
{
public:
QFactoryLoaderPrivate(const QString &suffix);
~QFactoryLoaderPrivate();
QMutex mutex;
QHash<QString,QPluginLoader*> pluginMap;
@ -53,6 +54,17 @@ QFactoryLoaderPrivate::QFactoryLoaderPrivate(const QString &asuffix)
{
}
QFactoryLoaderPrivate::~QFactoryLoaderPrivate()
{
if (qt_debug_component()) {
qDebug() << "QFactoryLoader: unloading" << suffix;
}
foreach (QPluginLoader *loader, pluginMap.values()) {
loader->unload();
delete loader;
}
}
QFactoryLoader::QFactoryLoader(const QString &suffix)
: d_ptr(new QFactoryLoaderPrivate(suffix))
{