diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-02-21 12:42:22 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-02-21 12:42:22 +0300 |
commit | 2e73efa9b8d32de57fbf27657273f2d1b078010a (patch) | |
tree | 1920d7bc7ae7c25de4ad3665de0008a4ca8790f3 /source/blender/blenkernel | |
parent | b1946e7f7ad2c9a308060f4f1a06f82cdcb4c8a5 (diff) |
Depsgraph: Fix crash using --debug-depsgraph and --debug-depsgraph-no-threads
Was accessing past the array boundaries.
Should be safe for 2.79a.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 423ed2af057..2e5b14cd902 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1518,6 +1518,8 @@ typedef struct ThreadedObjectUpdateState { bool has_mballs; #endif + int num_threads; + /* Execution statistics */ bool has_updated_objects; ListBase *statistics; @@ -1617,7 +1619,6 @@ static void scene_update_object_add_task(void *node, void *user_data) static void print_threads_statistics(ThreadedObjectUpdateState *state) { - int i, tot_thread; double finish_time; if ((G.debug & G_DEBUG_DEPSGRAPH) == 0) { @@ -1645,10 +1646,9 @@ static void print_threads_statistics(ThreadedObjectUpdateState *state) } #else finish_time = PIL_check_seconds_timer(); - tot_thread = BLI_system_thread_count(); int total_objects = 0; - for (i = 0; i < tot_thread; i++) { + for (int i = 0; i < state->num_threads; i++) { int thread_total_objects = 0; double thread_total_time = 0.0; StatisicsEntry *entry; @@ -1745,6 +1745,7 @@ static void scene_update_objects(EvaluationContext *eval_ctx, Main *bmain, Scene "scene update objects stats"); state.has_updated_objects = false; state.base_time = PIL_check_seconds_timer(); + state.num_threads = tot_thread; } #ifdef MBALL_SINGLETHREAD_HACK |