From 4ae9361151c478532784da24e6ae3e332391782e Mon Sep 17 00:00:00 2001 From: James Larcombe Date: Fri, 23 Jul 2010 12:56:30 +0100 Subject: [PATCH] Fixed crash when creating two QPainters on the same QPaintDevice by ensuring the same reference count is checked as the one that is incremented and decremented. --- src/gui/painting/qpainter.cpp | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 9dadbd5..c60b445 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1712,11 +1712,6 @@ bool QPainter::begin(QPaintDevice *pd) { Q_ASSERT(pd); - if (pd->painters > 0) { - qWarning("QPainter::begin: A paint device can only be painted by one painter at a time."); - return false; - } - if (d_ptr->engine) { qWarning("QPainter::begin: Painter already active"); return false; @@ -1748,6 +1743,13 @@ bool QPainter::begin(QPaintDevice *pd) if (rpd) pd = rpd; + if (pd->painters > 0) { + qWarning("QPainter::begin: A paint device can only be painted by one painter at a time."); + d->helper_device = 0; + d->original_device = 0; + return false; + } + #ifdef QT_DEBUG_DRAW if (qt_show_painter_debug_output) printf("QPainter::begin(), device=%p, type=%d\n", pd, pd->devType()); -- 1.7.0.2.msysgit.0