SDL - fix re-entrancy into SDL_UpdateFullscreenMode under OSX. During HideWindow we get a RESTORED event which then turns fullscreen back on causing a hang in Cocoa_SetWindowFullscreenSpace waiting for the fullscreen transition to finish.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index 992b4f3..f552cb5 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -93,6 +93,7 @@ struct SDL_Window
SDL_Surface *surface;
SDL_bool surface_valid;
+ SDL_bool is_hiding;
SDL_bool is_destroying;
SDL_WindowShaper *shaper;
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index e50edc1..0c92a87 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1105,6 +1105,10 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
CHECK_WINDOW_MAGIC(window,);
+ /* if we are in the process of hiding don't go back to fullscreen */
+ if ( window->is_hiding && fullscreen )
+ return;
+
#ifdef __MACOSX__
if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
window->last_fullscreen_flags = window->flags;
@@ -1833,11 +1837,13 @@ SDL_HideWindow(SDL_Window * window)
return;
}
+ window->is_hiding = SDL_TRUE;
SDL_UpdateFullscreenMode(window, SDL_FALSE);
if (_this->HideWindow) {
_this->HideWindow(_this, window);
}
+ window->is_hiding = SDL_FALSE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
}