Skip to content

Commit 8b924df

Browse files
committed
Use an autoreleasepool in Cocoa_GetDisplayUsableBounds()
Fixes #12571
1 parent 82335fd commit 8b924df

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/video/cocoa/SDL_cocoamodes.m

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -556,22 +556,24 @@ bool Cocoa_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, S
556556

557557
bool Cocoa_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
558558
{
559-
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->internal;
560-
NSScreen *screen = GetNSScreenForDisplayID(displaydata->display);
559+
@autoreleasepool {
560+
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->internal;
561+
NSScreen *screen = GetNSScreenForDisplayID(displaydata->display);
561562

562-
if (screen == nil) {
563-
return SDL_SetError("Couldn't get NSScreen for display");
564-
}
563+
if (screen == nil) {
564+
return SDL_SetError("Couldn't get NSScreen for display");
565+
}
565566

566-
{
567-
const NSRect frame = [screen visibleFrame];
568-
rect->x = (int)frame.origin.x;
569-
rect->y = (int)(CGDisplayPixelsHigh(kCGDirectMainDisplay) - frame.origin.y - frame.size.height);
570-
rect->w = (int)frame.size.width;
571-
rect->h = (int)frame.size.height;
572-
}
567+
{
568+
const NSRect frame = [screen visibleFrame];
569+
rect->x = (int)frame.origin.x;
570+
rect->y = (int)(CGDisplayPixelsHigh(kCGDirectMainDisplay) - frame.origin.y - frame.size.height);
571+
rect->w = (int)frame.size.width;
572+
rect->h = (int)frame.size.height;
573+
}
573574

574-
return true;
575+
return true;
576+
}
575577
}
576578

577579
bool Cocoa_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)

0 commit comments

Comments
 (0)