Fix T103101: random Cycles animation rendering freezing up the application

This commit is contained in:
2022-12-14 19:47:21 +01:00
parent 4121e32edd
commit 56237f33a1

View File

@@ -1046,14 +1046,19 @@ bool RE_engine_render(Render *re, bool do_all)
re->engine = engine;
}
/* create render result */
/* Create render result. Do this before acquiring lock, to avoid lock
* inversion as this calls python to get the render passes, while python UI
* code can also hold a lock on the render result. */
const bool create_new_result = (re->result == nullptr || !(re->r.scemode & R_BUTS_PREVIEW));
RenderResult *new_result = engine_render_create_result(re);
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
if (re->result == nullptr || !(re->r.scemode & R_BUTS_PREVIEW)) {
if (create_new_result) {
if (re->result) {
render_result_free(re->result);
}
re->result = engine_render_create_result(re);
re->result = new_result;
}
BLI_rw_mutex_unlock(&re->resultmutex);