Fix reentrancy problem in image reading
There were race conditions when accessing the plugin factory and the image reader plugins from different threads; ref QTBUG-29281. Added a mutex lock to avoid. Change-Id: Ic1a3b6cbaf5603f1bcf7025b58247a9a3f6d08a9 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
parent
f6c5452d97
commit
e28c03cb82
@ -133,6 +133,7 @@
|
||||
// factory loader
|
||||
#include <qcoreapplication.h>
|
||||
#include <private/qfactoryloader_p.h>
|
||||
#include <QMutexLocker>
|
||||
|
||||
// image handlers
|
||||
#include <private/qbmphandler_p.h>
|
||||
@ -232,6 +233,9 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
|
||||
QByteArray suffix;
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMATPLUGIN
|
||||
static QMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
|
||||
typedef QMultiMap<int, QString> PluginKeyMap;
|
||||
|
||||
// check if we have plugins that support the image format
|
||||
|
Loading…
Reference in New Issue
Block a user