1From b1f41f2b6ad442494d31fa18692d1201545c3f26 Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Wed, 6 Jun 2018 21:26:46 +0800 4Subject: [PATCH 10/28] qoffscreensurface: Clear current surface before destroy 5 6Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 7--- 8 src/gui/kernel/qoffscreensurface.cpp | 6 ++++++ 9 1 file changed, 6 insertions(+) 10 11diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp 12index c74fe0b3..563cb410 100644 13--- a/src/gui/kernel/qoffscreensurface.cpp 14+++ b/src/gui/kernel/qoffscreensurface.cpp 15@@ -234,6 +234,12 @@ void QOffscreenSurface::destroy() 16 QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed); 17 QGuiApplication::sendEvent(this, &e); 18 19+#ifndef QT_NO_OPENGL 20+ QOpenGLContext *context = QOpenGLContext::currentContext(); 21+ if (context && context->surface() == this) 22+ context->doneCurrent(); 23+#endif 24+ 25 delete d->platformOffscreenSurface; 26 d->platformOffscreenSurface = nullptr; 27 if (d->offscreenWindow) { 28-- 292.20.1 30 31