Fix crashes in SwiftShader with PPAPI
SwiftShader had been crashing on certain websites with Flash. This change prevents that.
diff --git a/src/Renderer/Surface.cpp b/src/Renderer/Surface.cpp
index 3767123..8dc90ae 100644
--- a/src/Renderer/Surface.cpp
+++ b/src/Renderer/Surface.cpp
@@ -727,11 +727,12 @@
Surface::~Surface()
{
+ // Synchronize so we can deallocate the buffers below
+ resource->lock(DESTRUCT);
+ resource->unlock();
+
if(!hasParent)
{
- // Synchronize so we can deallocate the buffers below
- resource->lock(DESTRUCT);
- resource->unlock();
resource->destruct();
}