diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-02-10 06:10:57 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-03-01 11:05:20 (GMT) |
commit | b67d537070e88feb708d13b46cd1468e2c0dc0e8 (patch) | |
tree | 537c67b82782bcb04b2589fd10a51427e306184b | |
parent | 48cd01714e3aa76872983cae820cfc1c7504b065 (diff) | |
download | Qt-b67d537070e88feb708d13b46cd1468e2c0dc0e8.zip Qt-b67d537070e88feb708d13b46cd1468e2c0dc0e8.tar.gz Qt-b67d537070e88feb708d13b46cd1468e2c0dc0e8.tar.bz2 |
Allow using QPixmap outside GUI thread when using raster
-rw-r--r-- | src/gui/image/qpixmap.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index f896572..b276180 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -98,12 +98,21 @@ static bool qt_pixmap_thread_test() qFatal("QPixmap: Must construct a QApplication before a QPaintDevice"); return false; } -#ifndef Q_WS_WIN - if (!QApplication::testAttribute(Qt::AA_X11InitThreads) && qApp->thread() != QThread::currentThread()) { - qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread"); - return false; - } + + if (qApp->thread() != QThread::currentThread()) { + bool fail = false; +#if defined (Q_WS_X11) + if (!QApplication::testAttribute(Qt::AA_X11InitThreads)) + fail = true; +#else + if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) + fail = true; #endif + if (fail) { + qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread"); + return false; + } + } return true; } |