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