From b6ab41d131eebc03f7f48373f81daa1d65ffb4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Wed, 27 Jan 2010 16:26:41 +0000 Subject: [PATCH] Don't crash in PaintUtils::transition() if the pixmap doesn't have a paint engine. This is sometimes the case when called from AbstractTaskItem::drawTask(). svn path=/trunk/KDE/kdelibs/; revision=1081054 --- paintutils.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/paintutils.cpp b/paintutils.cpp index 2fe794d4a..4becf2c1a 100644 --- a/paintutils.cpp +++ b/paintutils.cpp @@ -196,8 +196,10 @@ QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount) // If the native paint engine supports Porter/Duff compositing and CompositionMode_Plus - if (from.paintEngine()->hasFeature(QPaintEngine::PorterDuff) && - from.paintEngine()->hasFeature(QPaintEngine::BlendModes)) { + QPaintEngine *paintEngine = from.paintEngine(); + if (paintEngine && + paintEngine->hasFeature(QPaintEngine::PorterDuff) && + paintEngine->hasFeature(QPaintEngine::BlendModes)) { QPainter p; p.begin(&targetPixmap); @@ -216,7 +218,7 @@ QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount) } #if defined(Q_WS_X11) && defined(HAVE_XRENDER) // We have Xrender support - else if (from.paintEngine()->hasFeature(QPaintEngine::PorterDuff)) { + else if (paintEngine && paintEngine->hasFeature(QPaintEngine::PorterDuff)) { // QX11PaintEngine doesn't implement CompositionMode_Plus in Qt 4.3, // which we need to be able to do a transition from one pixmap to // another.