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>2021-03-15 08:26:57 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-03-15 08:37:20 +0300
commit2939251a05c29b6462065394714a79195d067029 (patch)
tree77453b5c6b7e970ca0c2917a468ecff16fe3418f /source/blender/windowmanager/intern/wm_event_system.c
parent684971c2f27d59e7a0938d59e047dc4b71ce0c25 (diff)
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.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c18
1 files changed, 9 insertions, 9 deletions
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);
}
}