summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTrond Kjernaasen <trond@trolltech.com>2009-03-02 12:17:40 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-03-23 11:45:25 (GMT)
commitdc789e34bd2ff519024af077bebdf09c85e138e0 (patch)
treeb61b46b890a6877900368c21b5b95e4336c64996 /src
parentebaeb25bebdd29651f15b6e53119597633ea854f (diff)
downloadQt-dc789e34bd2ff519024af077bebdf09c85e138e0.zip
Qt-dc789e34bd2ff519024af077bebdf09c85e138e0.tar.gz
Qt-dc789e34bd2ff519024af077bebdf09c85e138e0.tar.bz2
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')
-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 d758221..ff7c1b6 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 2e4da40..7296426 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;