Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_script/script_edit.c')
-rw-r--r--source/blender/editors/space_script/script_edit.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index f739bfe367e..bde7bdb77f1 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -39,7 +39,7 @@
#include "ED_screen.h"
-#include "script_intern.h" // own include
+#include "script_intern.h" /* own include */
#ifdef WITH_PYTHON
# include "BPY_extern_run.h"
@@ -115,15 +115,32 @@ static int script_reload_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- WM_script_tag_reload();
+ /* TODO(campbell): this crashes on netrender and keying sets, need to look into why
+ * disable for now unless running in debug mode. */
+
+ /* It would be nice if we could detect when this is called from the Python
+ * only postponing in that case, for now always do it. */
+ if (true) {
+ /* Postpone when called from Python so this can be called from an operator
+ * that might be re-registered, crashing Blender when we try to read from the
+ * freed operator type which, see T80694. */
+ BPY_run_string_exec(C,
+ (const char *[]){"bpy", NULL},
+ "def fn():\n"
+ " bpy.utils.load_scripts(reload_scripts=True)\n"
+ " return None\n"
+ "bpy.app.timers.register(fn)");
+ }
+ else {
+ WM_cursor_wait(true);
+ BPY_run_string_eval(
+ C, (const char *[]){"bpy", NULL}, "bpy.utils.load_scripts(reload_scripts=True)");
+ WM_cursor_wait(false);
+ }
+
+ /* Note that #WM_script_tag_reload is called from `bpy.utils.load_scripts`,
+ * any additional updates required by this operator should go there. */
- /* TODO, this crashes on netrender and keying sets, need to look into why
- * disable for now unless running in debug mode */
- WM_cursor_wait(1);
- BPY_run_string_eval(
- C, (const char *[]){"bpy", NULL}, "bpy.utils.load_scripts(reload_scripts=True)");
- WM_cursor_wait(0);
- WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
#else
UNUSED_VARS(C, op);