Fix T61512: Crash switching workspace with fullscreen area

In this case we simply create a new screen area that copies the currently
fullscreened area.

Note: At the moment there is no indicative in the non-main window that we are in
fullscreen. That happens because this information is part of the bar and we have
no topbar in this window.
This commit is contained in:
Dalai Felinto
2019-02-15 19:13:17 -02:00
parent 2b7752fb00
commit eff3728db9

View File

@@ -64,13 +64,22 @@ WorkSpaceLayout *ED_workspace_layout_duplicate(
bScreen *screen_new;
WorkSpaceLayout *layout_new;
if (BKE_screen_is_fullscreen_area(screen_old)) {
return NULL; /* XXX handle this case! */
}
layout_new = ED_workspace_layout_add(bmain, workspace, win, name);
screen_new = BKE_workspace_layout_screen_get(layout_new);
screen_data_copy(screen_new, screen_old);
if (BKE_screen_is_fullscreen_area(screen_old)) {
for (ScrArea *area_old = screen_old->areabase.first; area_old; area_old = area_old->next) {
if (area_old->full) {
ScrArea *area_new = (ScrArea *)screen_new->areabase.first;
ED_area_data_copy(area_new, area_old, true);
ED_area_tag_redraw(area_new);
break;
}
}
}
else {
screen_data_copy(screen_new, screen_old);
}
return layout_new;
}