[Bf-blender-cvs] [afc60f99570] blender-v3.0-release: Fix T92704: Redrawing while saving crashes outside the main thread

Jeducious noreply at git.blender.org
Tue Nov 9 05:21:09 CET 2021


Commit: afc60f995701ec6d41a05823b248db624ea1fcc6
Author: Jeducious
Date:   Tue Nov 9 15:13:40 2021 +1100
Branches: blender-v3.0-release
https://developer.blender.org/rBafc60f995701ec6d41a05823b248db624ea1fcc6

Fix T92704: Redrawing while saving crashes outside the main thread

If the blend file is saved from a script in another thread,
like the render thread for example, Blender will crash on the call that
redraws the UI.

Ref D13140

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

M	source/blender/windowmanager/intern/wm_files.c

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

diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 67222cc07f9..0074ecc392d 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1793,8 +1793,9 @@ static bool wm_file_write(bContext *C,
   /* Enforce full override check/generation on file save. */
   BKE_lib_override_library_main_operations_create(bmain, true);
 
-  if (!G.background) {
-    /* Redraw to remove menus that might be open. */
+  if (!G.background && BLI_thread_is_main()) {
+    /* Redraw to remove menus that might be open.
+     * But only in the main thread otherwise this can crash, see T92704. */
     WM_redraw_windows(C);
   }



More information about the Bf-blender-cvs mailing list