Fix: Interactive Docking modal operator re-run glitch

Docking can close windows during its operation. If the current window
does not match before and after an operator has run our event handling
code can assume that a new blend file has been loaded and will rerun
the operator. This PR avoid this problem by just not starting if the
event initiating it is of type WINDEACTIVATE. There might be a later
fix that addresses the underlying issue, but this is simple, small, and
harmless.

Pull Request: https://projects.blender.org/blender/blender/pulls/126379
This commit is contained in:
Jonas Holzman
2024-09-19 00:47:37 +02:00
committed by Harley Acheson
parent 6385296e56
commit aa5385f648

View File

@@ -4155,6 +4155,11 @@ static void area_join_cancel(bContext *C, wmOperator *op)
/* modal callback while selecting area (space) that will be removed */
static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
if (event->type == WINDEACTIVATE) {
/* This operator can close windows, which can cause it to be re-run. */
return OPERATOR_FINISHED;
}
if (op->customdata == nullptr) {
if (!area_join_init(C, op, nullptr, nullptr)) {
return OPERATOR_CANCELLED;