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>2018-06-14 22:55:40 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-14 22:58:11 +0300
commit1adfabc8c62ed3f067d209511ce3d868e76c9bbd (patch)
tree74b47e4c8fd86eb673b65a6dbf85ca51e1f89e4c /source/blender/editors/undo/ed_undo.c
parent7afa59e37a539174385d8a2484e2b17ae43e0a85 (diff)
WM: revert part of Top-Bar inclusion
This removes OperatorRepeatContextHandle, from 5f6c45498c92b since we now only have redo in the area an operator is executed in. These values could be invalid and crashed in some cases.
Diffstat (limited to 'source/blender/editors/undo/ed_undo.c')
-rw-r--r--source/blender/editors/undo/ed_undo.c42
1 files changed, 9 insertions, 33 deletions
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 6731a0d2e5b..102065f5295 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -302,36 +302,6 @@ void ED_OT_undo_redo(wmOperatorType *ot)
/** \} */
-struct OperatorRepeatContextHandle {
- ScrArea *restore_area;
- ARegion *restore_region;
-};
-
-/**
- * Resets the context to the state \a op was executed in (or at least, was in when registering).
- * #ED_operator_repeat_reset_context should be called when done repeating!
- */
-const OperatorRepeatContextHandle *ED_operator_repeat_prepare_context(bContext *C, wmOperator *op)
-{
- static OperatorRepeatContextHandle context_info;
-
- context_info.restore_area = CTX_wm_area(C);
- context_info.restore_region = CTX_wm_region(C);
-
- CTX_wm_area_set(C, op->execution_area);
- CTX_wm_region_set(C, op->execution_region);
-
- return &context_info;
-}
-/**
- * Resets context to the old state from before #ED_operator_repeat_prepare_context was called.
- */
-void ED_operator_repeat_reset_context(bContext *C, const OperatorRepeatContextHandle *context_info)
-{
- CTX_wm_area_set(C, context_info->restore_area);
- CTX_wm_region_set(C, context_info->restore_region);
-}
-
/* -------------------------------------------------------------------- */
/** \name Operator Repeat
* \{ */
@@ -346,8 +316,13 @@ int ED_undo_operator_repeat(bContext *C, wmOperator *op)
wmWindowManager *wm = CTX_wm_manager(C);
struct Scene *scene = CTX_data_scene(C);
- const OperatorRepeatContextHandle *context_info;
- context_info = ED_operator_repeat_prepare_context(C, op);
+ /* keep in sync with logic in view3d_panel_operator_redo() */
+ ARegion *ar_orig = CTX_wm_region(C);
+ ARegion *ar_win = BKE_area_find_region_active_win(CTX_wm_area(C));
+
+ if (ar_win) {
+ CTX_wm_region_set(C, ar_win);
+ }
if ((WM_operator_repeat_check(C, op)) &&
(WM_operator_poll(C, op->type)) &&
@@ -393,7 +368,8 @@ int ED_undo_operator_repeat(bContext *C, wmOperator *op)
}
}
- ED_operator_repeat_reset_context(C, context_info);
+ /* set region back */
+ CTX_wm_region_set(C, ar_orig);
}
else {
CLOG_WARN(&LOG, "called with NULL 'op'");