[Bf-blender-cvs] [2939251a05c] master: Fix regression with modal operator file load check
Campbell Barton
noreply at git.blender.org
Mon Mar 15 06:40:52 CET 2021
Commit: 2939251a05c29b6462065394714a79195d067029
Author: Campbell Barton
Date: Mon Mar 15 16:26:57 2021 +1100
Branches: master
https://developer.blender.org/rB2939251a05c29b6462065394714a79195d067029
Fix regression with modal operator file load check
As of 2cc5af9c553cfc00b7d4616445ad954597a92d94, checking the window
managers pointer for changes is no longer a valid way
to check a file has been loaded.
===================================================================
M source/blender/windowmanager/intern/wm_event_system.c
===================================================================
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 39651db54f0..ed1b53e8e20 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2063,6 +2063,7 @@ static int wm_handler_operator_call(bContext *C,
else if (ot->modal) {
/* We set context to where modal handler came from. */
wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win = CTX_wm_window(C);
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
@@ -2080,22 +2081,21 @@ static int wm_handler_operator_call(bContext *C,
retval = ot->modal(C, op, event);
OPERATOR_RETVAL_CHECK(retval);
- /* When this is _not_ the case the modal modifier may have loaded
- * a new blend file (demo mode does this), so we have to assume
- * the event, operator etc have all been freed. - campbell */
- if (CTX_wm_manager(C) == wm) {
+ if (ot->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) {
+ wm->op_undo_depth--;
+ }
- wm_event_modalkeymap_end(event, &event_backup);
+ /* When the window changes the the modal modifier may have loaded a new blend file
+ * (the `system_demo_mode` add-on does this), so we have to assume the event,
+ * operator, area, region etc have all been freed. */
+ if ((CTX_wm_window(C) == win)) {
- if (ot->flag & OPTYPE_UNDO) {
- wm->op_undo_depth--;
- }
+ wm_event_modalkeymap_end(event, &event_backup);
if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) {
wm_operator_reports(C, op, retval, false);
if (op->type->modalkeymap) {
- wmWindow *win = CTX_wm_window(C);
WM_window_status_area_tag_redraw(win);
}
}
More information about the Bf-blender-cvs
mailing list