diff options
author | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-08-01 11:22:31 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-08-01 23:17:44 +0200 |
commit | 76859e50d4b986fb88c2f193a70fd9b40963c59a (patch) | |
tree | 510d5553d472017e343fc1ca755ea7e313313d39 /src/quick/items/context2d/qquickcontext2dtexture_p.h | |
parent | 557d73575978b873bb01ea791ae237fa6067fa7f (diff) |
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 <laszlo.agocs@digia.com>
Diffstat (limited to 'src/quick/items/context2d/qquickcontext2dtexture_p.h')
-rw-r--r-- | src/quick/items/context2d/qquickcontext2dtexture_p.h | 10 |
1 files changed, 9 insertions, 1 deletions
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<QQuickContext2DTile*> m_tiles; - QQuickContext2D* m_context; + QQuickContext2D *m_context; + + QOpenGLContext *m_gl; + QSurface *m_surface; QQuickContext2D::State m_state; |