From b561707bed0e4a464ffa8f8027fa7869b1544fb4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 4 Apr 2018 17:24:57 +0200 Subject: Gawain: Make removing batches more thread safe The issue was mainly visible when copy-on-write was enabled. This was forcing lots of meshes to be freed from multiple thread, causing all sorts of race conditions in Gawain's VAO code. OpenGL resources seems already to be doing deferred deletion, need to do the same for CPU side arrays. --- intern/gawain/src/gwn_vertex_array_id.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'intern') diff --git a/intern/gawain/src/gwn_vertex_array_id.cpp b/intern/gawain/src/gwn_vertex_array_id.cpp index ed54562c434..ad60dea7542 100644 --- a/intern/gawain/src/gwn_vertex_array_id.cpp +++ b/intern/gawain/src/gwn_vertex_array_id.cpp @@ -166,5 +166,7 @@ void gwn_context_add_batch(Gwn_Context* ctx, Gwn_Batch* batch) void gwn_context_remove_batch(Gwn_Context* ctx, Gwn_Batch* batch) { + ctx->orphans_mutex.lock(); ctx->batches.erase(batch); + ctx->orphans_mutex.unlock(); } -- cgit v1.2.3