internal/uidriver/glfw: Bug fix: Memory leak in Objective-C code

Use an autorelease pool block.

Closes #1698
This commit is contained in:
Hajime Hoshi 2021-07-07 04:34:19 +09:00
parent a6ea4dbb74
commit 1b415ad7f6

View File

@ -22,21 +22,23 @@ package glfw
// #import <AppKit/AppKit.h> // #import <AppKit/AppKit.h>
// //
// static void currentMonitorPos(uintptr_t windowPtr, int* x, int* y) { // static void currentMonitorPos(uintptr_t windowPtr, int* x, int* y) {
// NSScreen* screen = [NSScreen mainScreen]; // @autoreleasepool {
// if (windowPtr) { // NSScreen* screen = [NSScreen mainScreen];
// NSWindow* window = (NSWindow*)windowPtr; // if (windowPtr) {
// if ([window isVisible]) { // NSWindow* window = (NSWindow*)windowPtr;
// // When the window is visible, the window is already initialized. // if ([window isVisible]) {
// // [NSScreen mainScreen] sometimes tells a lie when the window is put across monitors (#703). // // When the window is visible, the window is already initialized.
// screen = [window screen]; // // [NSScreen mainScreen] sometimes tells a lie when the window is put across monitors (#703).
// screen = [window screen];
// }
// } // }
// NSDictionary* screenDictionary = [screen deviceDescription];
// NSNumber* screenID = [screenDictionary objectForKey:@"NSScreenNumber"];
// CGDirectDisplayID aID = [screenID unsignedIntValue];
// const CGRect bounds = CGDisplayBounds(aID);
// *x = bounds.origin.x;
// *y = bounds.origin.y;
// } // }
// NSDictionary* screenDictionary = [screen deviceDescription];
// NSNumber* screenID = [screenDictionary objectForKey:@"NSScreenNumber"];
// CGDirectDisplayID aID = [screenID unsignedIntValue];
// const CGRect bounds = CGDisplayBounds(aID);
// *x = bounds.origin.x;
// *y = bounds.origin.y;
// } // }
// //
// static bool isNativeFullscreen() { // static bool isNativeFullscreen() {