[Bf-blender-cvs] [cf09a2443ce] master: Fix T60978: crash toggling window fullscreen on macOS.

Brecht Van Lommel noreply at git.blender.org
Fri Mar 8 10:25:35 CET 2019


Commit: cf09a2443cef60cda28c2c2023cb84728e644081
Author: Brecht Van Lommel
Date:   Fri Mar 8 02:17:31 2019 +0100
Branches: master
https://developer.blender.org/rBcf09a2443cef60cda28c2c2023cb84728e644081

Fix T60978: crash toggling window fullscreen on macOS.

GHOST event handling does not need a window in the context, and restoring
it to the previous value is problematic if the window was deleted in the
meantime.

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

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 ae9d4467112..89b7e53a93a 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1449,10 +1449,6 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
 						wm_event_do_handlers(C);
 						wm_event_do_notifiers(C);
 						wm_draw_update(C);
-
-						/* Warning! code above nulls 'C->wm.window', causing BGE to quit, see: T45699.
-						 * Further, its easier to match behavior across platforms, so restore the window. */
-						CTX_wm_window_set(C, win);
 #endif
 					}
 				}
@@ -1473,14 +1469,12 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
 			case GHOST_kEventOpenMainFile:
 			{
 				PointerRNA props_ptr;
-				wmWindow *oldWindow;
 				const char *path = GHOST_GetEventData(evt);
 
 				if (path) {
 					wmOperatorType *ot = WM_operatortype_find("WM_OT_open_mainfile", false);
 					/* operator needs a valid window in context, ensures
 					 * it is correctly set */
-					oldWindow = CTX_wm_window(C);
 					CTX_wm_window_set(C, win);
 
 					WM_operator_properties_create_ptr(&props_ptr, ot);
@@ -1488,7 +1482,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
 					WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &props_ptr);
 					WM_operator_properties_free(&props_ptr);
 
-					CTX_wm_window_set(C, oldWindow);
+					CTX_wm_window_set(C, NULL);
 				}
 				break;
 			}
@@ -1557,10 +1551,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
 
 					// close all popups since they are positioned with the pixel
 					// size baked in and it's difficult to correct them
-					wmWindow *oldWindow = CTX_wm_window(C);
 					CTX_wm_window_set(C, win);
 					UI_popup_handlers_remove_all(C, &win->modalhandlers);
-					CTX_wm_window_set(C, oldWindow);
+					CTX_wm_window_set(C, NULL);
 
 					wm_window_make_drawable(wm, win);



More information about the Bf-blender-cvs mailing list