diff options
author | Jani Hautakangas <ext-jani.hautakangas@nokia.com> | 2010-09-06 09:01:08 (GMT) |
---|---|---|
committer | Jani Hautakangas <ext-jani.hautakangas@nokia.com> | 2010-09-06 09:18:54 (GMT) |
commit | f4bada8cbba5f209556ad4e3703d412e4146a0af (patch) | |
tree | 55af56cddacdb5d152669416f6c9fb5c4c00a8d4 /src/gui | |
parent | b9fb38de38f364a4c51d301c8e3d2dbdb90399e6 (diff) | |
download | Qt-f4bada8cbba5f209556ad4e3703d412e4146a0af.zip Qt-f4bada8cbba5f209556ad4e3703d412e4146a0af.tar.gz Qt-f4bada8cbba5f209556ad4e3703d412e4146a0af.tar.bz2 |
QPixmaps try to access FBS connection after the connection has been closed.
This patch fixed the issue by tracking pixmaps and destroying native
bitmaps before FBS connection is closed.
Task-number: QTBUG-9112
Reviewed-by: Jason Barron
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 43 | ||||
-rw-r--r-- | src/gui/image/qpixmap_s60_p.h | 12 |
2 files changed, 53 insertions, 2 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 9d571b5..dbdf0bc 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -63,6 +63,42 @@ QT_BEGIN_NAMESPACE const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +static bool cleanup_function_registered = false; +static QS60PixmapData *firstPixmap = 0; + +static void qt_symbian_register_pixmap(QS60PixmapData *pd) +{ + if(!cleanup_function_registered) { + qAddPostRoutine(qt_symbian_release_pixmaps); + cleanup_function_registered = true; + } + + pd->next = firstPixmap; + pd->prev = 0; + if (firstPixmap) + firstPixmap->prev = pd; + firstPixmap = pd; +} + +static void qt_symbian_unregister_pixmap(QS60PixmapData *pd) +{ + if (pd->next) + pd->next->prev = pd->prev; + if (pd->prev) + pd->prev->next = pd->next; + else + firstPixmap = pd->next; +} + +static void qt_symbian_release_pixmaps() +{ + // Scan all QS60PixmapData objects in the system and destroy them. + QS60PixmapData *pd = firstPixmap; + while (pd != 0) { + pd->release(); + pd = pd->next; + } +} /* \class QSymbianFbsClient @@ -356,15 +392,18 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), cfbsBitmap(0), pengine(0), bytes(0), - formatLocked(false) + formatLocked(false), + next(0), + prev(0) { - + qt_symbian_register_pixmap(this); } QS60PixmapData::~QS60PixmapData() { release(); delete symbianBitmapDataAccess; + qt_symbian_unregister_pixmap(this); } void QS60PixmapData::resize(int width, int height) diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h index 85c9ebe..a82f5c2 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_s60_p.h @@ -63,6 +63,11 @@ class CFbsBitGc; class QSymbianBitmapDataAccess; +class QS60PixmapData; +void qt_symbian_register_pixmap(QS60PixmapData *pd); +void qt_symbian_unregister_pixmap(QS60PixmapData *pd); +void qt_symbian_release_pixmaps(); + class QSymbianFbsHeapLock { public: @@ -120,6 +125,13 @@ private: bool formatLocked; + QS60PixmapData *next; + QS60PixmapData *prev; + + friend void qt_symbian_register_pixmap(QS60PixmapData *pd); + friend void qt_symbian_unregister_pixmap(QS60PixmapData *pd); + friend void qt_symbian_release_pixmaps(); + friend class QPixmap; friend class QS60WindowSurface; friend class QS60PaintEngine; |