Concern for current GLFW MacOS targets

Monkey Targets Forums/Desktop/Concern for current GLFW MacOS targets

skid(Posted 2015) [#1]
https://developer.apple.com/news/?id=02202015a

from here.

In regards to monkey, this DOES seem to affect the GLFW targets on MacOS as they use standard autoreleasePool which from my understanding is not compatible with automatic Reference Counting (ARC) and hence deprecated and soon to be "outlawed".


SLotman(Posted 2015) [#2]
I've looked into the glfw2 target (not glfw3) and indeed there is some (few) autoreleasepool references in there, specifically in:

- _glfwPlatformInit and _glfwPlatformTerminate (cocoa_init.m)
- _glfwPlatformPollEvents (in cocoa_window.m)
- "id autoreleasePool;" in a GLFWGLOBAL struct (platform.h)

I unfortunately know nothing about MacOS to actually understand if that falls into Apple's new ARC restrictions or not.
Edit: Yes it does, quoting the link above: "You cannot use NSAutoreleasePool objects."

if I'm right, it's just those 3 references that needs to be updated - shouldn't be so hard to fix it.


SLotman(Posted 2015) [#3]
From what I read, this should be *part* of the fix:

_glfwPlatformInit, cocoa_init.m
   _glfwLibrary.autoreleasePool = [[NSAutoreleasePool alloc] init];

turns into:
   @autorelease { 
      _glfwLibrary.autoreleasePool = returnObject();
      [_glfwLibrary.autoreleasePool init];
   }

int _glfwPlatformTerminate, cocoa_init.m
   [_glfwLibrary.autoreleasePool release];
   _glfwLibrary.autoreleasePool = nil;

this is kept the same way.

void _glfwPlatformPollEvents(), cocoa_window.m
   [_glfwLibrary.autoreleasePool drain];
   _glfwLibrary.autoreleasePool = [[NSAutoreleasePool alloc] init];

is just commented out? Apparently the new @autorelease will drain it automatically?

Can someone test this and see if it compiles? I don't have my Mac around right now...


SLotman(Posted 2015) [#4]
No one even tried that? Guess I should then. Hope I have the time by next weekend :/