diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2010-09-14 12:18:27 (GMT) |
---|---|---|
committer | Samuli Piippo <samuli.piippo@digia.com> | 2011-06-09 10:06:52 (GMT) |
commit | 53eb7c5ee84dd2bfab11d94fb26448b9a94d5380 (patch) | |
tree | 6417093223866fd1685ad057f79af4d0aad64507 /src/opengl | |
parent | e5f73c552c3ccffc5a1dae959d81cba5b03a916a (diff) | |
download | Qt-53eb7c5ee84dd2bfab11d94fb26448b9a94d5380.zip Qt-53eb7c5ee84dd2bfab11d94fb26448b9a94d5380.tar.gz Qt-53eb7c5ee84dd2bfab11d94fb26448b9a94d5380.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
(cherry picked from commit cb764eaf91e3a8ef30b280671d5c991ec926d14c)
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qpaintengine_opengl.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 15fb932..e954e1d 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*))); |