Avoid incorrect warning when painting onto a QImage

Change Ia8ef48f3 introduced a regression: Trying to paint onto a
QImage, QPicture or QPrinter from outside the main thread incorrectly
shows a warning saying that it is not supported.

The patch was incorrect because 'extraCondition' was used in the
non-default branches of the switch and thus not passing
extraCondition==true caused the message appear even when it shouldn't
have.

Let's just remove the extraCondition parameter altogether since it is
not used in practice anyway.

Change-Id: Id2e56c585d1f1013f24942cbcd53305fbb66aeba
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Laszlo Agocs 2013-11-21 19:21:25 +01:00 committed by The Qt Project
parent 28c5c74c9b
commit 376ccedd1a

View File

@ -146,17 +146,16 @@ static inline uint line_emulation(uint emulation)
}
#ifndef QT_NO_DEBUG
static bool qt_painter_thread_test(int devType, const char *what, bool extraCondition = false)
static bool qt_painter_thread_test(int devType, const char *what)
{
switch (devType) {
case QInternal::Image:
case QInternal::Printer:
case QInternal::Picture:
// can be drawn onto these devices safely from any thread
if (extraCondition)
break;
break;
default:
if (!extraCondition && QThread::currentThread() != qApp->thread()) {
if (QThread::currentThread() != qApp->thread()) {
qWarning("QPainter: It is not safe to use %s outside the GUI thread", what);
return false;
}