summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSze Howe Koh <szehowe.koh@gmail.com>2021-07-24 22:14:57 +0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-06 16:34:51 +0000
commit00f29b77c0e996f03a8ff7967ca33ea5f0499d65 (patch)
tree637f6d684e93a589f4e4bd2f0fd277c74b62d721
parent8220b43c5b3bed8bf48355639cccb1bc8be2a565 (diff)
qt_pixmap_thread_test(): Simplify logic, merge warnings
Change-Id: I0c413c14d124bafbd6b2bd94d7a128e19ed83ade Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit ee2ac8b4ef3b8691ef8b9d17a6d4c95b95db4349) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/gui/image/qpixmap.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index b1be8ff408..7748ae8285 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -81,17 +81,11 @@ static bool qt_pixmap_thread_test()
qFatal("QPixmap: Must construct a QGuiApplication before a QPixmap");
return false;
}
-
- if (QGuiApplicationPrivate::instance() && qApp->thread() != QThread::currentThread()) {
- bool fail = false;
- if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) {
- printf("Platform plugin does not support threaded pixmaps!\n");
- fail = true;
- }
- if (fail) {
- qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread");
- return false;
- }
+ if (QGuiApplicationPrivate::instance()
+ && qApp->thread() != QThread::currentThread()
+ && !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) {
+ qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread on this platform");
+ return false;
}
return true;
}