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:
authorCampbell Barton <ideasman42@gmail.com>2013-06-28 20:15:44 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-28 20:15:44 +0400
commit8b96383b8fa0bb50020bdfa4453cc8de28d64e7f (patch)
tree5a70fe22966ddad0068c2845135046a55545689c /source/blender/editors/space_script
parentdc851350457a55726d20655da73881f3534ef5e8 (diff)
fix [#35860] crash if pressing <F8> in import dialog
disallow reloading scripts while running modal, python operators.
Diffstat (limited to 'source/blender/editors/space_script')
-rw-r--r--source/blender/editors/space_script/script_edit.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 8074ec57474..ddf2bd27513 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -36,10 +36,12 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
+#include "BKE_report.h"
#include "BKE_global.h"
#include "WM_api.h"
#include "WM_types.h"
+#include "wm_event_system.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -84,10 +86,41 @@ void SCRIPT_OT_python_file_run(wmOperatorType *ot)
RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "Path", "");
}
+#ifdef WITH_PYTHON
+static bool script_test_modal_operators(bContext *C)
+{
+ wmWindowManager *wm;
+ wmWindow *win;
+
+ wm = CTX_wm_manager(C);
+
+ for (win = wm->windows.first; win; win = win->next) {
+ wmEventHandler *handler;
+
+ for (handler = win->modalhandlers.first; handler; handler = handler->next) {
+ if (handler->op) {
+ wmOperatorType *ot = handler->op->type;
+ if (ot->ext.srna) {
+ return true;
+ }
+ }
+ }
+ }
-static int script_reload_exec(bContext *C, wmOperator *UNUSED(op))
+ return false;
+}
+#endif
+
+static int script_reload_exec(bContext *C, wmOperator *op)
{
#ifdef WITH_PYTHON
+
+ /* clear running operators */
+ if (script_test_modal_operators(C)) {
+ BKE_report(op->reports, RPT_ERROR, "Can't reload with running modal operators");
+ return OPERATOR_CANCELLED;
+ }
+
/* 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);