Commit: 5aff002f7b3ad52f6a88dc0a3c2eac482b57da3e
Author: Clément Foucault
Date:   Thu Feb 22 14:31:10 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB5aff002f7b3ad52f6a88dc0a3c2eac482b57da3e

GWN: Context: Fix allocation/codestyle and crash on startup.

===================================================================

M       intern/gawain/src/gwn_vertex_array_id.cpp

===================================================================

diff --git a/intern/gawain/src/gwn_vertex_array_id.cpp 
b/intern/gawain/src/gwn_vertex_array_id.cpp
index c5611c8f606..f0233dd0ef9 100644
--- a/intern/gawain/src/gwn_vertex_array_id.cpp
+++ b/intern/gawain/src/gwn_vertex_array_id.cpp
@@ -38,6 +38,11 @@ struct Gwn_Context {
 #if TRUST_NO_ONE
        pthread_t thread; // Thread on which this context is active.
        bool thread_is_used;
+
+       Gwn_Context()
+               {
+               thread_is_used = false;
+               }
 #endif
 };
 
@@ -60,8 +65,7 @@ Gwn_Context* GWN_context_create(void)
 #if TRUST_NO_ONE
        assert(thread_is_main());
 #endif
-       Gwn_Context* ctx = (Gwn_Context*)calloc(1, sizeof(Gwn_Context));
-       new (&ctx->orphans_mutex) std::mutex();
+       Gwn_Context* ctx = new Gwn_Context;
        glGenVertexArrays(1, &ctx->default_vao);
        GWN_context_active_set(ctx);
        return ctx;
@@ -83,10 +87,7 @@ void GWN_context_discard(Gwn_Context* ctx)
                gwn_batch_vao_cache_clear(ctx->batches.front());
                }
        glDeleteVertexArrays(1, &ctx->default_vao);
-       (&ctx->orphaned_vertarray_ids)->~vector();
-       (&ctx->orphans_mutex)->~mutex();
-       (&ctx->batches)->~forward_list();
-       free(ctx);
+       delete ctx;
        active_ctx = NULL;
        }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to