Fix T88755: Reuse Temp Windows by Type not Title

Reuse temporary windows when they share the same single area type, not
because they share the same title.

See D12401 for more details.

Differential Revision: https://developer.blender.org/D12401

Reviewed by Campbell Barton
This commit is contained in:
Harley Acheson 2021-09-09 09:26:44 -07:00
parent 45c44a5b5b
commit 84d03a1298
Notes: blender-bot 2023-02-14 11:28:43 +01:00
Referenced by issue #88924, Blender crashed while importing the file
Referenced by issue #88755, Blender opens a new render window even when one is open already.
1 changed files with 6 additions and 5 deletions

View File

@ -808,16 +808,17 @@ wmWindow *WM_window_open(bContext *C,
/* changes rect to fit within desktop */
wm_window_check_size(&rect);
/* Reuse temporary windows when they share the same title. */
/* Reuse temporary windows when they share the same single area. */
wmWindow *win = NULL;
if (temp) {
LISTBASE_FOREACH (wmWindow *, win_iter, &wm->windows) {
if (WM_window_is_temp_screen(win_iter)) {
char *wintitle = GHOST_GetTitle(win_iter->ghostwin);
if (STREQ(title, wintitle)) {
const bScreen *screen = WM_window_get_active_screen(win_iter);
if (screen && screen->temp && BLI_listbase_is_single(&screen->areabase)) {
ScrArea *area = screen->areabase.first;
if (space_type == (area->butspacetype ? area->butspacetype : area->spacetype)) {
win = win_iter;
break;
}
free(wintitle);
}
}
}