From 76859e50d4b986fb88c2f193a70fd9b40963c59a Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 1 Aug 2014 11:22:31 +0200 Subject: More QQuickCanvas cleanup handling. Avoid calling into QQuickContext2D from QQuickContext2DTexture after QQuickContext2D has been deleted. We acheive this by 1. Giving the texture a direct pointer to the gl context and and surface, so that it doesn't need to go through m_context to get to them (which may have been deleted). 2. Protect access to QQuickContext2DTexture::m_context with a mutex and make sure it is set to 0 in a safe manner when the QQuickContext2D object is deleted. Change-Id: Ie0a30f9fc46f844224838a7cdf2f28a62e8ce322 Reviewed-by: Laszlo Agocs --- src/quick/items/context2d/qquickcontext2dtexture_p.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/quick/items/context2d/qquickcontext2dtexture_p.h') diff --git a/src/quick/items/context2d/qquickcontext2dtexture_p.h b/src/quick/items/context2d/qquickcontext2dtexture_p.h index 186863c1aa..e41a4809e4 100644 --- a/src/quick/items/context2d/qquickcontext2dtexture_p.h +++ b/src/quick/items/context2d/qquickcontext2dtexture_p.h @@ -113,6 +113,11 @@ public: virtual QSGTexture *textureForNextFrame(QSGTexture *lastFrame) = 0; bool event(QEvent *e); + void initializeOpenGL(QOpenGLContext *gl, QOffscreenSurface *s) { + m_gl = gl; + m_surface = s; + } + Q_SIGNALS: void textureChanged(); @@ -135,7 +140,10 @@ protected: QRect createTiles(const QRect& window); QList m_tiles; - QQuickContext2D* m_context; + QQuickContext2D *m_context; + + QOpenGLContext *m_gl; + QSurface *m_surface; QQuickContext2D::State m_state; -- cgit v1.2.3