summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap.cpp
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond.kjernasen@nokia.com>2010-04-30 13:33:26 (GMT)
committerTrond Kjernåsen <trond.kjernasen@nokia.com>2010-07-02 10:25:18 (GMT)
commit778ee2e9a2db3f3a1bc9d282356798baa77f6efd (patch)
tree1d4ef0896a977edb9262aa9146a12117ea7be988 /src/gui/image/qpixmap.cpp
parentdecda7ea196b610ab1d70345cb89a4a67bfd1e91 (diff)
downloadQt-778ee2e9a2db3f3a1bc9d282356798baa77f6efd.zip
Qt-778ee2e9a2db3f3a1bc9d282356798baa77f6efd.tar.gz
Qt-778ee2e9a2db3f3a1bc9d282356798baa77f6efd.tar.bz2
Add an application attribute to control XInitThreads().
In order to make Xlib thread-safe XInitThreads() needs to be the first Xlib call issued. This attribute controls this behavior. Having Xlib thread-safe will most likely incur some overhead, which is why this is not done by default.
Diffstat (limited to 'src/gui/image/qpixmap.cpp')
-rw-r--r--src/gui/image/qpixmap.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index e630e80..a2b0b95 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -94,13 +94,12 @@ Q_GUI_EXPORT qint64 qt_pixmap_id(const QPixmap &pixmap)
static bool qt_pixmap_thread_test()
{
- return true;
if (!qApp) {
qFatal("QPixmap: Must construct a QApplication before a QPaintDevice");
return false;
}
#ifndef Q_WS_WIN
- if (qApp->thread() != QThread::currentThread()) {
+ 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;
}