Dont use a global autorelease variable

Use function local @autorelease blocks instead
This commit is contained in:
Kovid Goyal
2019-03-06 09:34:55 +05:30
parent a1c49a0f7f
commit 7ab63525c7
3 changed files with 17 additions and 6 deletions

View File

@@ -324,7 +324,7 @@ is_cmd_period(NSEvent *event, NSEventModifierFlags modifierFlags) {
int _glfwPlatformInit(void)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool {
_glfw.ns.helper = [[GLFWHelper alloc] init];
[NSThread detachNewThreadSelector:@selector(doNothing:)
@@ -392,13 +392,14 @@ int _glfwPlatformInit(void)
_glfwInitJoysticksNS();
_glfwPollMonitorsNS();
[pool drain];
}
return GLFW_TRUE;
}
void _glfwPlatformTerminate(void)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool {
if (_glfw.ns.displayLinks.lock) {
_glfwClearDisplayLinks();
[_glfw.ns.displayLinks.lock release];
@@ -445,7 +446,7 @@ void _glfwPlatformTerminate(void)
_glfwTerminateNSGL();
_glfwTerminateJoysticksNS();
[pool drain];
}
}
const char* _glfwPlatformGetVersionString(void)

View File

@@ -1805,7 +1805,7 @@ requestRenderFrame(_GLFWwindow *w, GLFWcocoarenderframefun callback) {
void _glfwCocoaPostEmptyEvent(short subtype, long data1, bool at_start)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool {
NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
location:NSMakePoint(0, 0)
modifierFlags:0
@@ -1816,7 +1816,7 @@ void _glfwCocoaPostEmptyEvent(short subtype, long data1, bool at_start)
data1:data1
data2:0];
[NSApp postEvent:event atStart:at_start ? YES : NO];
[pool drain];
}
}
void _glfwPlatformPostEmptyEvent(void)