Fix T44979: Crash when rendering with more threads than the system ones

Revert "Nodes: Remove hardcoded BLENDER_MAX_THREADS number of threads"

This reverts commit fdc653e8ce.

The threads override is not affected by the scene, and hence the limit of the
threads was not giving correct result. Need to re-consider some things here.
This commit is contained in:
2015-06-08 13:46:33 +02:00
parent d63615272c
commit ec0ba4095f
4 changed files with 6 additions and 10 deletions

View File

@@ -235,8 +235,7 @@ bNodeTreeExec *ntreeShaderBeginExecTree_internal(bNodeExecContext *context, bNod
exec = ntree_exec_begin(context, ntree, parent_key);
/* allocate the thread stack listbase array */
exec->tot_thread = BLI_system_thread_count();
exec->threadstack = MEM_callocN(exec->tot_thread * sizeof(ListBase), "thread stack array");
exec->threadstack = MEM_callocN(BLENDER_MAX_THREADS * sizeof(ListBase), "thread stack array");
for (node = exec->nodetree->nodes.first; node; node = node->next)
node->need_exec = 1;
@@ -273,7 +272,7 @@ void ntreeShaderEndExecTree_internal(bNodeTreeExec *exec)
int a;
if (exec->threadstack) {
for (a = 0; a < exec->tot_thread; a++) {
for (a = 0; a < BLENDER_MAX_THREADS; a++) {
for (nts = exec->threadstack[a].first; nts; nts = nts->next)
if (nts->stack) MEM_freeN(nts->stack);
BLI_freelistN(&exec->threadstack[a]);