With ANGLE (which always uses this loop) EGL_CONTEXT_LOST
may happen quite often, depending on various factors.
It is therefore good to handle this by tearing down and
reinitializing the scenegraph.
Task-number: QTBUG-43263
Change-Id: I8e985e001f46865ccd814255f39add58fe2a737a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
if (!d->isRenderable())
return;
- if (!m_gl->makeCurrent(window))
- return;
+ if (!m_gl->makeCurrent(window)) {
+ // Check for context loss.
+ if (!m_gl->isValid()) {
+ d->cleanupNodesOnShutdown();
+ m_rc->invalidate();
+ if (m_gl->create() && m_gl->makeCurrent(window))
+ m_rc->initialize(m_gl);
+ else
+ return;
+ }
+ }
d->flushDelayedTouchEvent();
// Event delivery or processing has caused the window to stop rendering.