Fixed crash when creating a dummy window on Mac OS X

This commit is contained in:
Sam Lantinga 2016-12-11 11:45:33 -08:00
parent d6bcec8f6a
commit cb5a0b0f6a

View File

@ -1164,8 +1164,9 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
CHECK_WINDOW_MAGIC(window,-1);
/* if we are in the process of hiding don't go back to fullscreen */
if ( window->is_hiding && fullscreen )
if (window->is_hiding && fullscreen) {
return 0;
}
#ifdef __MACOSX__
/* if the window is going away and no resolution change is necessary,
@ -1174,6 +1175,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
return 0;
if (SDL_strcmp(_this->name, "dummy") != 0) {
/* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
@ -1194,6 +1196,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
window->last_fullscreen_flags = window->flags;
return 0;
}
}
#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
/* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
or not. The user can choose this, via OS-provided UI, but this can't