[Bf-blender-cvs] [d5d97e41699] master: Fix T92704: Redrawing while saving crashes outside the main thread

Jeducious noreply at git.blender.org
Tue Nov 9 05:29:08 CET 2021


Commit: d5d97e41699982110747d252daff427ae96a0f48
Author: Jeducious
Date:   Tue Nov 9 15:13:40 2021 +1100
Branches: master
https://developer.blender.org/rBd5d97e41699982110747d252daff427ae96a0f48

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