Fix #141313: Clear Screen active_region for Area swap
If screen areas are swapped between windows this can cause an ASAN heap-use-after-free because of invalid screen->active_region pointer. That pointer is quickly reassigned as mouse movement indicates the active region, so just clear them for this operation. Pull Request: https://projects.blender.org/blender/blender/pulls/142877
This commit is contained in:
committed by
Harley Acheson
parent
9c3509bacc
commit
32dd728768
@@ -2614,6 +2614,16 @@ void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2)
|
||||
BKE_screen_area_free(tmp);
|
||||
MEM_delete(tmp);
|
||||
|
||||
/* The areas being swapped could be between different windows,
|
||||
* so clear screen active region pointers. This is set later
|
||||
* through regular operations. #141313. */
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
|
||||
if (bScreen *screen = WM_window_get_active_screen(win)) {
|
||||
screen->active_region = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* tell WM to refresh, cursor types etc */
|
||||
WM_event_add_mousemove(win);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user