From e28c03cb829c229209090d7939a9aba1af1fdea9 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 19 Feb 2013 18:11:16 +0100 Subject: Fix reentrancy problem in image reading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/gui/image/qimagereader.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gui/image/qimagereader.cpp') diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 5eaf7bb8f2..684778694e 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -133,6 +133,7 @@ // factory loader #include #include +#include // image handlers #include @@ -232,6 +233,9 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, QByteArray suffix; #ifndef QT_NO_IMAGEFORMATPLUGIN + static QMutex mutex; + QMutexLocker locker(&mutex); + typedef QMultiMap PluginKeyMap; // check if we have plugins that support the image format -- cgit v1.2.3