diff options
author | Sze Howe Koh <szehowe.koh@gmail.com> | 2021-07-24 22:12:36 +0800 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2021-09-04 03:43:44 +0200 |
commit | ee5077daf59f24ca535302799ad718935e6bc4b8 (patch) | |
tree | 1d3a67b61b31135b5df401830065342b63aaca9a /src/gui | |
parent | ae8e96d4c2fc430ed6f71e422ef4aff2c7f15186 (diff) |
QPixmap: Fix crash if created without gui app in secondary thread
The thread checking in in_pixmap_thread_test() is only safe, and only
makes sense, if we have a QGuiApplication. If we only have
QCoreApplication, only null QPixmaps may be created anyway, so
threading makes no difference.
Fixes: QTBUG-95358
Pick-to: 6.2
Change-Id: I93c983a3d6c271b0a19dfd0384862fc151459029
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qpixmap.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 3d46dc4a6b..b1be8ff408 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -82,7 +82,7 @@ static bool qt_pixmap_thread_test() return false; } - if (qApp->thread() != QThread::currentThread()) { + 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"); |