diff options
author | Jason Barron <jason.barron@nokia.com> | 2010-08-25 11:51:42 (GMT) |
---|---|---|
committer | Jason Barron <jason.barron@nokia.com> | 2010-09-10 14:48:35 (GMT) |
commit | ff98c93a33170b8fdc28b553490819b51cb80d86 (patch) | |
tree | 086db5ca87da6d580e62604702a198dfd2497c76 /src/gui | |
parent | 771cfe6f172820a1a370255cb74e066913408a6f (diff) | |
download | Qt-ff98c93a33170b8fdc28b553490819b51cb80d86.zip Qt-ff98c93a33170b8fdc28b553490819b51cb80d86.tar.gz Qt-ff98c93a33170b8fdc28b553490819b51cb80d86.tar.bz2 |
Fix crash in QRuntimeGraphicsSystem due to destruction order.
Firstly, fix a "leak" by deleting the graphics system when QApplication
is destroyed.
Secondly, fix a crash when the following scenario occurs:
- ~QApplication() deletes the current graphics system (see above)
- ~QApplication() calls qt_cleanup()
- qt_cleanup() calls QPixmapCache::clear() to delete pixmaps
- ~QRuntimePixmapData() tries to remove the pixmap from the runtime
graphics system, but it has already been deleted.
- *Crash*
Reviewed-by: Gunnar Sletta
Reviewed-by: Jani Hautakangas
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystem_runtime.cpp | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 82dd83a..ebad56e 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -1116,6 +1116,8 @@ QApplication::~QApplication() QApplicationPrivate::app_style = 0; delete QApplicationPrivate::app_icon; QApplicationPrivate::app_icon = 0; + delete QApplicationPrivate::graphics_system; + QApplicationPrivate::graphics_system = 0; #ifndef QT_NO_CURSOR d->cursor_list.clear(); #endif diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 2828e9d..a9fbbee 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -94,7 +94,8 @@ QRuntimePixmapData::QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelTy QRuntimePixmapData::~QRuntimePixmapData() { - m_graphicsSystem->removePixmapData(this); + if (QApplicationPrivate::graphics_system) + m_graphicsSystem->removePixmapData(this); delete m_data; } @@ -258,7 +259,8 @@ QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, Q QRuntimeWindowSurface::~QRuntimeWindowSurface() { - m_graphicsSystem->removeWindowSurface(this); + if (QApplicationPrivate::graphics_system) + m_graphicsSystem->removeWindowSurface(this); } QPaintDevice *QRuntimeWindowSurface::paintDevice() |