سؤال

I have a borderless window that I close via a menubar item attached to this action (in the window controller):

- (void)closeMenuBar
{
    [[self window] close];
    [[NSApp delegate] closeMenubar];
}

The appdelegate then simply sets the NSMutableArray with the window controller references in it to nil. (I'm using ARC).

However, after the window is closed, the window controller still appears to be running (as is evident by NSLog statements). What am I doing wrong? How can I remove this controller immediately with ARC enabled?

هل كانت مفيدة؟

المحلول

Make sure you don't have any strong references to it elsewhere.

If you can't track them down, try running in Instruments with Allocations to get an idea of where it's being retained. You can examine the stack trace of each place it's retained.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top