summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-09-14 12:18:27 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-09-14 12:26:03 (GMT)
commitcb764eaf91e3a8ef30b280671d5c991ec926d14c (patch)
tree751ffafc3570ef37eeb591057c70622fb75f5380 /src
parent05eb27a2007ebc1cae40c6331ee8b4d2fb76c1d9 (diff)
downloadQt-cb764eaf91e3a8ef30b280671d5c991ec926d14c.zip
Qt-cb764eaf91e3a8ef30b280671d5c991ec926d14c.tar.gz
Qt-cb764eaf91e3a8ef30b280671d5c991ec926d14c.tar.bz2
Prevent crash in QGLGlyphCache due to dangling context references.
We need to clear the context from the cache when it's destroyed even if it doesn't belong to a widget. Task-number: QTBUG-13622 Reviewed-by: Trond
Diffstat (limited to 'src')
-rw-r--r--src/opengl/qpaintengine_opengl.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index fc31548..5c3ea58 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -4737,9 +4737,11 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, const QTextItemInt &ti,
font_cache = new QGLFontGlyphHash;
// qDebug() << "new context" << context << font_cache;
qt_context_cache.insert(context, font_cache);
- if (context->isValid() && context->device()->devType() == QInternal::Widget) {
- QWidget *widget = static_cast<QWidget *>(context->device());
- connect(widget, SIGNAL(destroyed(QObject*)), SLOT(widgetDestroyed(QObject*)));
+ if (context->isValid()) {
+ if (context->device()->devType() == QInternal::Widget) {
+ QWidget *widget = static_cast<QWidget *>(context->device());
+ connect(widget, SIGNAL(destroyed(QObject*)), SLOT(widgetDestroyed(QObject*)));
+ }
connect(QGLSignalProxy::instance(),
SIGNAL(aboutToDestroyContext(const QGLContext*)),
SLOT(cleanupContext(const QGLContext*)));