WM: free operators when repeating
Needed since the active operator isn't ensured to be the last.
This commit is contained in:
parent
647fb6ef1e
commit
f13c729b26
|
@ -2903,7 +2903,8 @@ static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot)
|
|||
|
||||
static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
wmOperator *lastop = CTX_wm_manager(C)->operators.last;
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmOperator *lastop = wm->operators.last;
|
||||
|
||||
/* Seek last registered operator */
|
||||
while (lastop) {
|
||||
|
@ -2916,6 +2917,7 @@ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
}
|
||||
|
||||
if (lastop) {
|
||||
WM_operator_free_all_after(wm, lastop);
|
||||
WM_operator_repeat(C, lastop);
|
||||
}
|
||||
|
||||
|
|
|
@ -419,6 +419,9 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
|
|||
|
||||
if (G.debug & G_DEBUG)
|
||||
printf("redo_cb: operator redo %s\n", op->type->name);
|
||||
|
||||
WM_operator_free_all_after(wm, op);
|
||||
|
||||
ED_undo_pop_op(C, op);
|
||||
|
||||
if (op->type->check) {
|
||||
|
|
|
@ -252,6 +252,7 @@ int WM_operator_confirm_message(struct bContext *C, struct wmOperator *o
|
|||
|
||||
/* operator api */
|
||||
void WM_operator_free (struct wmOperator *op);
|
||||
void WM_operator_free_all_after(wmWindowManager *wm, struct wmOperator *op);
|
||||
void WM_operator_type_set(struct wmOperator *op, struct wmOperatorType *ot);
|
||||
void WM_operator_stack_clear(struct wmWindowManager *wm);
|
||||
void WM_operator_handlers_clear(wmWindowManager *wm, struct wmOperatorType *ot);
|
||||
|
|
|
@ -107,6 +107,17 @@ void WM_operator_free(wmOperator *op)
|
|||
MEM_freeN(op);
|
||||
}
|
||||
|
||||
void WM_operator_free_all_after(wmWindowManager *wm, struct wmOperator *op)
|
||||
{
|
||||
op = op->next;
|
||||
while (op != NULL) {
|
||||
wmOperator *op_next = op->next;
|
||||
BLI_remlink(&wm->operators, op);
|
||||
WM_operator_free(op);
|
||||
op = op_next;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use with extreme care!,
|
||||
* properties, customdata etc - must be compatible.
|
||||
|
|
Loading…
Reference in New Issue