[Bf-blender-cvs] [53c63db2ee1] blender2.8: Fix issue with closing child windows in recent changes.

Brecht Van Lommel noreply at git.blender.org
Wed Jul 4 19:33:35 CEST 2018


Commit: 53c63db2ee1bd544384840915c7f562819a7dbbc
Author: Brecht Van Lommel
Date:   Wed Jul 4 19:11:45 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB53c63db2ee1bd544384840915c7f562819a7dbbc

Fix issue with closing child windows in recent changes.

===================================================================

M	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 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();
 	}



More information about the Bf-blender-cvs mailing list