From 854c2fc96fff3b73b98819ca4810e5f97df37285 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 13 Mar 2012 12:33:34 +0100 Subject: [PATCH] Avoid race condition MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit m_damaged may be set from a different thread while updateTexture() is being executed. This change does not eliminate the race completely, but will fail by creating the same texture twice instead of keeping an old, invalid one. Change-Id: Ic34d6df1699bd3d94fde3590343e4a524c9de6a2 Reviewed-by: Gunnar Sletta Reviewed-by: Samuel Rødal --- src/compositor/compositor_api/waylandsurfaceitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compositor/compositor_api/waylandsurfaceitem.cpp b/src/compositor/compositor_api/waylandsurfaceitem.cpp index 7a19244..704cba0 100644 --- a/src/compositor/compositor_api/waylandsurfaceitem.cpp +++ b/src/compositor/compositor_api/waylandsurfaceitem.cpp @@ -324,6 +324,7 @@ private: void WaylandSurfaceItem::updateTexture() { if (m_damaged) { + m_damaged = false; QSGTexture *oldTexture = m_texture; if (m_surface->type() == WaylandSurface::Texture) { QOpenGLContext *context = QOpenGLContext::currentContext(); @@ -337,7 +338,6 @@ void WaylandSurfaceItem::updateTexture() } delete oldTexture; - m_damaged = false; } if (m_provider) { -- 2.7.4