Skip to content

Commit

Permalink
qt_pixmap_thread_test(): Simplify logic, merge warnings
Browse files Browse the repository at this point in the history
Pick-to: 6.2
Change-Id: I0c413c14d124bafbd6b2bd94d7a128e19ed83ade
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
  • Loading branch information
JKSH committed Sep 6, 2021
1 parent e9e8d67 commit ee2ac8b
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/gui/image/qpixmap.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit ee2ac8b

Please sign in to comment.