summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorTrond Kjernaasen <trond@trolltech.com>2009-03-02 13:17:40 +0100
committerThiago Macieira <thiago.macieira@nokia.com>2009-03-23 12:45:25 +0100
commitdc789e34bd2ff519024af077bebdf09c85e138e0 (patch)
treeb61b46b890a6877900368c21b5b95e4336c64996 /src/gui/image
parentebaeb25bebdd29651f15b6e53119597633ea854f (diff)
Fixes: Crash in QPixmap under X11.
Task: 246446 RevBy: Olivier AutoTest: tst_qpixmap::test_246446() Details: The new QX11PixmapData object wasn't referenced (e.g. the ref count would be 0) after calling setMask() on a 32 bit QPixmap when Xrender was used.
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qpixmap_x11.cpp6
-rw-r--r--src/gui/image/qpixmapdata_p.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index d7582217e3..ff7c1b6776 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -1288,6 +1288,12 @@ void QX11PixmapData::setMask(const QBitmap &newmask)
0, 0, 0, 0, 0, 0, w, h);
release();
*this = newData;
+ // the new QX11PixmapData object isn't referenced yet, so
+ // ref it
+ ref.ref();
+
+ // the below is to make sure the QX11PixmapData destructor
+ // doesn't delete our newly created render picture
newData.hd = 0;
newData.x11_mask = 0;
newData.picture = 0;
diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h
index 2e4da40333..7296426238 100644
--- a/src/gui/image/qpixmapdata_p.h
+++ b/src/gui/image/qpixmapdata_p.h
@@ -109,6 +109,7 @@ protected:
private:
friend class QPixmap;
friend class QGLContextPrivate;
+ friend class QX11PixmapData;
QAtomicInt ref;
int detach_no;