Fix #131751: When Merging Areas Clear Screen.active_region if Active Area Changes

Area "close" operation is actually an area merge of some area into the
one being closed. This means that screen->active_region will be
pointing at deallocated RAM. Normally not noticed because active_region
is set very quickly to the new area, but error nonetheless and noticed
by ASAN. This PR sets the screen->active_region to null when merges
change the active area.

Pull Request: https://projects.blender.org/blender/blender/pulls/131994
This commit is contained in:
Harley Acheson
2024-12-16 22:19:08 +01:00
committed by Harley Acheson
parent ba47bcdb7c
commit 22bda12af7

View File

@@ -560,6 +560,12 @@ static bool screen_area_join_ex(
ED_area_tag_redraw(side2);
}
if (sa1 != CTX_wm_area(C)) {
/* Active area has changed so active region could be invalid. It is
* safe to set null and let it be set later by mouse position. #131751. */
screen->active_region = nullptr;
}
BKE_icon_changed(screen->id.icon_id);
return true;
}