diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-04 20:11:45 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-04 20:33:15 +0300 |
commit | 53c63db2ee1bd544384840915c7f562819a7dbbc (patch) | |
tree | 392ad12fc990178a97b8b7aa69dc5757f49f0060 | |
parent | 535fec06612799c2355525fa5332780e2472caac (diff) |
Fix issue with closing child windows in recent changes.
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index f902c4377cc..e4ccf074bab 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -474,29 +474,26 @@ void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win) /* this is event from ghost, or exit-blender op */ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) { - wmWindow *tmpwin; - - /* first check if we have to quit (there are non-temp and non-child windows remaining) */ - if (win->parent == NULL) { - for (tmpwin = wm->windows.first; tmpwin; tmpwin = tmpwin->next) { - if (tmpwin == win) - continue; - if (tmpwin->parent == NULL) - break; - if (WM_window_is_temp_screen(tmpwin) == false) - break; + /* First check if there is another main window remaining. */ + wmWindow *win_other; + for (win_other = wm->windows.first; win_other; win_other = win_other->next) { + if (win_other != win && + win_other->parent == NULL && + !WM_window_is_temp_screen(win_other)) + { + break; } + } - if (tmpwin == NULL) { - wm_quit_with_optional_confirmation_prompt(C, win); - return; - } + if (win->parent == NULL && win_other == NULL) { + wm_quit_with_optional_confirmation_prompt(C, win); + return; } /* close child windows */ - for (tmpwin = wm->windows.first; tmpwin; tmpwin = tmpwin->next) { - if (tmpwin->parent == win) { - wm_window_close(C, wm, tmpwin); + for (wmWindow *win_child = wm->windows.first; win_child; win_child = win_child->next) { + if (win_child->parent == win) { + wm_window_close(C, wm, win_child); } } @@ -516,7 +513,7 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) ED_screen_exit(C, win, screen); } - if (tmpwin) { + if (win_other) { BLF_batch_reset(); gpu_batch_presets_reset(); immDeactivate(); @@ -525,9 +522,9 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) wm_window_free(C, wm, win); /* keep imediatemode active before the next `wm_window_make_drawable` call */ - if (tmpwin) { - GHOST_ActivateWindowDrawingContext(tmpwin->ghostwin); - GWN_context_active_set(tmpwin->gwnctx); + if (win_other) { + GHOST_ActivateWindowDrawingContext(win_other->ghostwin); + GWN_context_active_set(win_other->gwnctx); immActivate(); } |