summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2018-08-22 13:02:04 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2018-08-24 08:30:28 +0000
commitf71048a5314c93732a8a77460b465709b632ff5e (patch)
tree6b311d5e57d668c2579b8da782f25fbf8122edf8 /src
parent981b16d9ba5a4bb7c6fdc0009fda9a4a74a92f9a (diff)
Fix crash when combining QOpenGLWidget, QStaticText and Qt Quick
Under certain circumstances, if you had a widget with a QOpenGLPaintEngine, and drew QStaticText into this, and then later had Qt Quick access the same cache and try to resize it, we would get a crash because the resize function would have a pointer to the paint engine and try to access its shader manager (which would now be null, since this is outside the begin()/end() phase of the paint engine. The solution is to reset the paint engine pointer to null on the cache once it has been populated and it is no longer needed. [ChangeLog][QtGui][Text] Fixed a possible crash when combining QStaticText, QOpenGLWidget and Qt Quick in the same application. Task-number: QTBUG-70096 Change-Id: I7383ad7456d1a72499cfcd2da09a5a808d4b3eff Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp1
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index 3d1c362275..6a89089f18 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -1741,6 +1741,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
// we may have to re-bind brush textures after filling in the cache.
brushTextureDirty = (QT_BRUSH_TEXTURE_UNIT == glypchCacheTextureUnit);
}
+ cache->setPaintEnginePrivate(nullptr);
}
if (cache->width() == 0 || cache->height() == 0)
diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h
index 0b7b5f6082..598cb00ee5 100644
--- a/src/gui/opengl/qopengltextureglyphcache_p.h
+++ b/src/gui/opengl/qopengltextureglyphcache_p.h
@@ -152,6 +152,11 @@ public:
void clear();
+ QOpenGL2PaintEngineExPrivate *paintEnginePrivate() const
+ {
+ return pex;
+ }
+
private:
void setupVertexAttribs();