From e1b51ed1dbe88a21dadc1680e75e3a4fe229277d Mon Sep 17 00:00:00 2001 From: Gunnar Sletta <gunnar.sletta@digia.com> Date: Mon, 18 Nov 2013 15:27:20 +0100 Subject: [PATCH] Make sure we clean up GL resources before we delete the GL context. Task-number: QTBUG-34806 Change-Id: I5013baaff0ca86357292474976944c1a3056f219 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> --- src/quick/scenegraph/qsgrenderloop.cpp | 2 ++ src/quick/scenegraph/qsgwindowsrenderloop.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 0cc2a15c51..9c39ef65f9 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -242,6 +242,7 @@ void QSGGuiThreadRenderLoop::hide(QQuickWindow *window) if (m_windows.size() == 0) { if (!cd->persistentSceneGraph) { rc->invalidate(); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); if (!cd->persistentGLContext) { delete gl; gl = 0; @@ -255,6 +256,7 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window) hide(window); if (m_windows.size() == 0) { rc->invalidate(); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); delete gl; gl = 0; } diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index d5d12bd138..03ee4992bc 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -241,6 +241,7 @@ void QSGWindowsRenderLoop::hide(QQuickWindow *window) if (m_windows.size() == 0) { if (!cd->persistentSceneGraph) { QQuickWindowPrivate::get(window)->context->invalidate(); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); if (!cd->persistentGLContext) { delete m_gl; m_gl = 0; @@ -257,6 +258,7 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window) // If this is the last tracked window, clean up SG and GL. if (m_windows.size() == 0) { QQuickWindowPrivate::get(window)->context->invalidate(); + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); delete m_gl; m_gl = 0; } -- GitLab