Fix: UI: Failing assert when switching workspaces

172e9c5b83 attempted to move area type and region type initialization to
`ED_screens_init()` so it's done before region polls run (which depends on
region types). However this was only done for active workspaces, so when
changing workspaces region types may still be missing before region polling.

We could iterate all screens there instead, not just those from the active
workspace. But in the end I decided it's better to move this back to regular
screen refreshing, but before region polling. This way all this related logic
stays closer together. It still only runs on complete screen refreshes, so when
the screen layout changes generally.
This commit is contained in:
Julian Eisel
2024-12-04 16:19:59 +01:00
parent f9b627d29c
commit 63d759d6d4

View File

@@ -750,6 +750,14 @@ static void screen_refresh(bContext *C,
/* Exception for background mode, we only need the screen context. */
if (!G.background) {
if (do_refresh || force_full_refresh) {
ED_screen_areas_iter (win, screen, area) {
/* Set area and region types early so areas and regions are in a usable state. This may be
* needed by further (re-)initialization logic, specifically region polling needs it early
* on (see #130583). */
ED_area_and_region_types_init(area);
}
}
/* Returns true if a change was done that requires refreshing. */
if (screen_regions_poll(C, win, screen)) {
@@ -805,16 +813,6 @@ void ED_screens_init(bContext *C, Main *bmain, wmWindowManager *wm)
static_cast<WorkSpace *>(bmain->workspaces.first));
}
if (!G.background) {
const bScreen *screen = WM_window_get_active_screen(win);
ED_screen_areas_iter (win, screen, area) {
/* Set area and region types early so areas and regions are in a usable state. This may be
* needed by further (re-)initialization logic, specifically region polling needs it early
* on (see #130583). */
ED_area_and_region_types_init(area);
}
}
ED_screen_refresh(C, wm, win);
if (win->eventstate) {
ED_screen_set_active_region(nullptr, win, win->eventstate->xy);