I cannot see there is anything “advanced”  MRR (manual retain-release) going on 
in:

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];

        insert your viewer code here

[pool release];


That can’t be handled with @autoreleasepool, if you even need to handle it 
outside the main thread autoreleasepool 


In fact the above is a classic example of the old garbage collector in action. 


Geir, 


> On 8. jul. 2016, at 21.47, Geir Nøklebye <geir.nokle...@dayturn.com> wrote:
> 
>> Cinder Roxley said:
> 
>> The viewer has never used the garbage collector so it?s not an issue.
> 
> 
> 
> Why is it that in llopenglview-objc.mm, as en example, we have statement like:
> 
> NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] 
> initWithAttributes:attrs] autorelease];
> 
> or 
> 
> - (void)dealloc
> {
>       [[NSNotificationCenter defaultCenter] removeObserver:self];
>       [super dealloc];
> }
> 
> while Apples ARC migration guidelines states:
> 
> You cannot explicitly invoke dealloc, or implement or invoke retain, release, 
> retainCount, or autorelease.
> 
> You can’t invoke dealloc.
> 
> Custom dealloc methods in ARC do not require a call to [super dealloc] (it 
> actually results in a compiler error). The chaining to super is automated and 
> enforced by the compiler.
> 
> 
> Or in llwindowmacosx-objc.mm we have code such as:
> 
> bool copyToPBoard(const unsigned short *str, unsigned int len)
> {
>       NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
>       NSPasteboard *pboard = [NSPasteboard generalPasteboard];
>       [pboard clearContents];
>       
> 
>       NSArray *contentsToPaste = [[NSArray alloc] initWithObjects:[NSString 
> stringWithCharacters:str length:len], nil];
>       [pool release];
>       return [pboard writeObjects:contentsToPaste];
> }
> 
> Apple’s documentation specifically says how to rewrite this construct for 
> ARC. 
> 
> https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/index.html#//apple_ref/occ/cl/NSAutoreleasePool
>  
> <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/index.html#//apple_ref/occ/cl/NSAutoreleasePool>
> 
> 
> So all this code needs to be rewritten to support ARC or it will not run or 
> fail on 10.12. 
> 
> 
> Geir Nøklebye,

_______________________________________________
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges

Reply via email to