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/painting/qgraphicssystem_runtime.cpp | |
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/painting/qgraphicssystem_runtime.cpp')
-rw-r--r-- | src/gui/painting/qgraphicssystem_runtime.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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() |