CFRelease question
Mike Swingler
swingler at apple.com
Tue Sep 27 11:00:47 PDT 2011
On Sep 27, 2011, at 10:40 AM, Leonid Romanov wrote:
> Hi,
> I've got a question: if we CFRelease a NSWindow with the retain count 1, thus making it 0, will it result in dealloc chain calls? I'm asking this question because I'm investigating http://java.net/jira/browse/MACOSX_PORT-429 and my current theory is that something is wrong with the reference counting (I'm not sure about it, though).
Absolutely, CFRelease() will call -dealloc when the retain count reaches 0. CFRelease() of a window should occur on the main AppKit Thread 0, since the destruction of a window calls into other parts of AppKit.
A window may temporarily be retained/released/autoreleased by other things, like a block-copy when doing -[JNFRunLoop performOnMainThreadWaiting:withBlock:], or other actions which may introspect the list of open windows.
Regards,
Mike Swingler
Java Engineering
Apple Inc.
More information about the macosx-port-dev
mailing list