summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
diff options
context:
space:
mode:
authorElvis Lee <kwangwoong.lee@lge.com>2013-05-16 12:03:23 -0600
committerJørgen Lind <jorgen.lind@digia.com>2013-05-28 09:48:19 +0200
commitcb8c646db32760503fb1b3fde443cba9b8d32e12 (patch)
tree66c31f9aa9e753329a2062b7578f5fb6204bb3f1 /src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
parent33049ec00bb4d9b2a14c920327f0d2a8ec6a1080 (diff)
Make SurfaceBuffer::destroyTexture be reenterable
When QOpenGLSharedResourceGuard is freed, destroyTexture might be reentered to cause double free. If a texture has reference to wl_buffer which is already destroyed, freeing the texture with decreasing reference counter will call wl_resource_destroy for wl_buffer. Then destroyTexture will be reentered through destroy_listener_callback. Change-Id: I156f410ce1a05b3041b05a310b5d3d79d38e0a8c Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp')
-rw-r--r--src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
index a8ad3e0e1..ccd054cad 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
@@ -188,9 +188,11 @@ void SurfaceBuffer::destroyTexture()
#ifdef QT_COMPOSITOR_WAYLAND_GL
if (m_texture) {
Q_ASSERT(m_guard);
+ /* When QOpenGLSharedResourceGuard is freed, destroyTexture might be reentered
+ to cause double free. So clear m_texture first. */
+ m_texture = 0;
m_guard->free();
m_guard = 0;
- m_texture = 0;
}
#endif
}