Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-02-22 16:31:10 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-02-22 16:31:40 +0300
commit5aff002f7b3ad52f6a88dc0a3c2eac482b57da3e (patch)
tree6b835a4b4300737408fae71abcc26cf7b8cf2213 /intern/gawain
parent672e823578f5e871fcf8c6457e3389eff0507b42 (diff)
GWN: Context: Fix allocation/codestyle and crash on startup.
Diffstat (limited to 'intern/gawain')
-rw-r--r--intern/gawain/src/gwn_vertex_array_id.cpp13
1 files changed, 7 insertions, 6 deletions
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;
}