Fixed macOS build

This commit is contained in:
Sam Lantinga
2024-08-01 14:10:26 -07:00
parent 0b6eff4167
commit 230f1debd0
+5 -3
View File
@@ -2348,6 +2348,10 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window)
SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata); SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata);
if (data) { if (data) {
#ifdef SDL_VIDEO_OPENGL
NSArray *contexts;
#endif
if ([data.listener isInFullscreenSpace]) { if ([data.listener isInFullscreenSpace]) {
[NSMenu setMenuBarVisible:YES]; [NSMenu setMenuBarVisible:YES];
} }
@@ -2360,13 +2364,11 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window)
} }
#ifdef SDL_VIDEO_OPENGL #ifdef SDL_VIDEO_OPENGL
contexts = [data.nscontexts copy];
NSArray *contexts = [data.nscontexts copy];
for (SDLOpenGLContext *context in contexts) { for (SDLOpenGLContext *context in contexts) {
/* Calling setWindow:NULL causes the context to remove itself from the context list. */ /* Calling setWindow:NULL causes the context to remove itself from the context list. */
[context setWindow:NULL]; [context setWindow:NULL];
} }
#endif /* SDL_VIDEO_OPENGL */ #endif /* SDL_VIDEO_OPENGL */
if (window->shaper) { if (window->shaper) {