From ffd26b420ce991c983c68d6c2b00459aefd6c012 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 26 Mar 2020 12:46:25 +1100 Subject: Fix crash closing a window in background mode --- source/blender/windowmanager/intern/wm_window.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source/blender/windowmanager/intern/wm_window.c') diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index a3e1814f8d2..505383d295f 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -414,7 +414,7 @@ void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win) void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) { wmWindow *win_other; - const bool is_dialog = GHOST_IsDialogWindow(win->ghostwin); + const bool is_dialog = (G.background == false) ? GHOST_IsDialogWindow(win->ghostwin) : false; /* First check if there is another main window remaining. */ for (win_other = wm->windows.first; win_other; win_other = win_other->next) { @@ -434,9 +434,13 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) if (iter_win->parent == win) { wm_window_close(C, wm, iter_win); } - else if (is_dialog && iter_win != win && iter_win->parent && - (GHOST_GetWindowState(iter_win->ghostwin) != GHOST_kWindowStateMinimized)) { - wm_window_raise(iter_win); + else { + if (G.background == false) { + if (is_dialog && iter_win != win && iter_win->parent && + (GHOST_GetWindowState(iter_win->ghostwin) != GHOST_kWindowStateMinimized)) { + wm_window_raise(iter_win); + } + } } } -- cgit v1.2.3