[Bf-blender-cvs] [9e707802c23] blender-v2.79a-release: Depsgraph: Fix crash using --debug-depsgraph and --debug-depsgraph-no-threads

Sergey Sharybin noreply at git.blender.org
Wed Feb 21 10:53:10 CET 2018


Commit: 9e707802c23318898e140da71a4c0a04e1c7125a
Author: Sergey Sharybin
Date:   Wed Feb 21 10:42:22 2018 +0100
Branches: blender-v2.79a-release
https://developer.blender.org/rB9e707802c23318898e140da71a4c0a04e1c7125a

Depsgraph: Fix crash using --debug-depsgraph and --debug-depsgraph-no-threads

Was accessing past the array boundaries.

Should be safe for 2.79a.

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

M	source/blender/blenkernel/intern/scene.c

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

diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 348d6272c02..6fd53bb48d0 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1456,6 +1456,8 @@ typedef struct ThreadedObjectUpdateState {
 	bool has_mballs;
 #endif
 
+	int num_threads;
+
 	/* Execution statistics */
 	bool has_updated_objects;
 	ListBase *statistics;
@@ -1555,7 +1557,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) {
@@ -1583,10 +1584,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;
@@ -1683,6 +1683,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



More information about the Bf-blender-cvs mailing list