diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index 6633e1c427c..4bec8a61884 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -255,6 +255,9 @@ static int ed_undo_step_impl( BKE_undosys_print(wm->undo_stack); } + /* Force break out of the event loop. */ + CTX_wm_window_set(C, NULL); + return OPERATOR_FINISHED; } @@ -396,10 +399,11 @@ static int ed_undo_exec(bContext *C, wmOperator *op) { /* "last operator" should disappear, later we can tie this with undo stack nicer */ WM_operator_stack_clear(CTX_wm_manager(C)); + wmWindow *win = CTX_wm_window(C); int ret = ed_undo_step_direction(C, 1, op->reports); if (ret & OPERATOR_FINISHED) { /* Keep button under the cursor active. */ - WM_event_add_mousemove(CTX_wm_window(C)); + WM_event_add_mousemove(win); } ED_outliner_select_sync_from_all_tag(C); @@ -425,10 +429,11 @@ static int ed_undo_push_exec(bContext *C, wmOperator *op) static int ed_redo_exec(bContext *C, wmOperator *op) { + wmWindow *win = CTX_wm_window(C); int ret = ed_undo_step_direction(C, -1, op->reports); if (ret & OPERATOR_FINISHED) { /* Keep button under the cursor active. */ - WM_event_add_mousemove(CTX_wm_window(C)); + WM_event_add_mousemove(win); } ED_outliner_select_sync_from_all_tag(C); @@ -437,12 +442,13 @@ static int ed_redo_exec(bContext *C, wmOperator *op) static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op)) { + wmWindow *win = CTX_wm_window(C); wmOperator *last_op = WM_operator_last_redo(C); int ret = ED_undo_operator_repeat(C, last_op); ret = ret ? OPERATOR_FINISHED : OPERATOR_CANCELLED; if (ret & OPERATOR_FINISHED) { /* Keep button under the cursor active. */ - WM_event_add_mousemove(CTX_wm_window(C)); + WM_event_add_mousemove(win); } return ret; }