[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57852] trunk/blender/source/blender/ editors/space_script/script_edit.c: fix [#35860] crash if pressing <F8> in import dialog
Campbell Barton
ideasman42 at gmail.com
Fri Jun 28 18:15:45 CEST 2013
Revision: 57852
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57852
Author: campbellbarton
Date: 2013-06-28 16:15:44 +0000 (Fri, 28 Jun 2013)
Log Message:
-----------
fix [#35860] crash if pressing <F8> in import dialog
disallow reloading scripts while running modal, python operators.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_script/script_edit.c
Modified: trunk/blender/source/blender/editors/space_script/script_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_script/script_edit.c 2013-06-28 16:06:55 UTC (rev 57851)
+++ trunk/blender/source/blender/editors/space_script/script_edit.c 2013-06-28 16:15:44 UTC (rev 57852)
@@ -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 @@
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;
-static int script_reload_exec(bContext *C, wmOperator *UNUSED(op))
+ 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;
+ }
+ }
+ }
+ }
+
+ 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);
More information about the Bf-blender-cvs
mailing list