diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-11-11 20:39:46 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-11-12 22:14:12 +0300 |
commit | d59fa12f2ad5c57c68d63e476270fcd274b61062 (patch) | |
tree | 53021c1ae77da2a5b7524d7dcb1b692c13a94f4a /intern/cycles/render/session.cpp | |
parent | 5c01ecd2bf5d0dc0d42f90aba2a3d9f948d16bb8 (diff) |
Fix T82607: crash cancelling Cycles render during adaptive subdivision update
Now that the Blender sync mechanism deletes nodes from the scene, we need to
ensure scene update is stopped before we do this.
Also add some more early out in scene geometry update to ensure we do not
continue working on incomplete geometry data, though that was not the cause of
this crash.
Diffstat (limited to 'intern/cycles/render/session.cpp')
-rw-r--r-- | intern/cycles/render/session.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index c22e29043d3..8f64495c76b 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -94,21 +94,7 @@ Session::Session(const SessionParams ¶ms_) Session::~Session() { - if (session_thread) { - /* wait for session thread to end */ - progress.set_cancel("Exiting"); - - gpu_need_display_buffer_update = false; - gpu_need_display_buffer_update_cond.notify_all(); - - { - thread_scoped_lock pause_lock(pause_mutex); - pause = false; - } - pause_cond.notify_all(); - - wait(); - } + cancel(); if (params.write_render_cb) { /* Copy to display buffer and write out image if requested */ @@ -142,6 +128,25 @@ void Session::start() } } +void Session::cancel() +{ + if (session_thread) { + /* wait for session thread to end */ + progress.set_cancel("Exiting"); + + gpu_need_display_buffer_update = false; + gpu_need_display_buffer_update_cond.notify_all(); + + { + thread_scoped_lock pause_lock(pause_mutex); + pause = false; + } + pause_cond.notify_all(); + + wait(); + } +} + bool Session::ready_to_reset() { double dt = time_dt() - reset_time; |