diff options
-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 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*))); |