[Bf-blender-cvs] [86f8898ccd3] blender-v3.3-release: Fix T101618: Freeze when reloading a library in certain situation

Philipp Oeser noreply at git.blender.org
Mon Oct 17 16:31:18 CEST 2022


Commit: 86f8898ccd3b6981572e6765f15dc6c42be7692c
Author: Philipp Oeser
Date:   Thu Oct 6 12:10:26 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB86f8898ccd3b6981572e6765f15dc6c42be7692c

Fix T101618: Freeze when reloading a library in certain situation

Freeze happened when reloading a library while having an Object property
with a custom getter function defined in Python.

Just piggybacking on rB62eb21e3ce87, this just applies the same fix (use
the BPy_BEGIN/END_ALLOW_THREADS macros) to relading from RNA/py.

All credit goes to @brecht and @mont29.

Maniphest Tasks: T101618

Differential Revision: https://developer.blender.org/D16167

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

M	source/blender/makesrna/intern/rna_ID.c

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

diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 242bfd99eae..293386d2f37 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -1392,6 +1392,19 @@ static void rna_Library_version_get(PointerRNA *ptr, int *value)
   value[2] = lib->subversionfile;
 }
 
+static void rna_Library_reload(Library *lib, bContext *C, ReportList *reports)
+{
+#  ifdef WITH_PYTHON
+  BPy_BEGIN_ALLOW_THREADS;
+#  endif
+
+  WM_lib_reload(lib, C, reports);
+
+#  ifdef WITH_PYTHON
+  BPy_END_ALLOW_THREADS;
+#  endif
+}
+
 #else
 
 static void rna_def_ID_properties(BlenderRNA *brna)
@@ -2236,7 +2249,7 @@ static void rna_def_library(BlenderRNA *brna)
   RNA_def_property_clear_flag(prop, PROP_EDITABLE);
   RNA_def_property_flag(prop, PROP_THICK_WRAP);
 
-  func = RNA_def_function(srna, "reload", "WM_lib_reload");
+  func = RNA_def_function(srna, "reload", "rna_Library_reload");
   RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
   RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks");
 }



More information about the Bf-blender-cvs mailing list