Re: potential leak warnings from static analyzer on window controllers

James Walker

On 12/7/2017 11:29 AM, Quincey Morris wrote:
On Dec 7, 2017, at 09:32 , James Walker <list2@...> wrote:

What should I be doing differently?

You could create a persistent reference. If your window controller will have only one instance (such as a non-document app’s main window), you can have a simple static variable in (say) the window controller class’s implementation file. If there are multiple window controllers, you can add the references to a global array in (say) the app delegate (and do a release after adding, to keep the retain count balanced).

Then, when the window closes, you will release and nil the static variable, or remove the reference from the array, rather than doing the [self release].

Thanks for the ideas!  I ended up using a global NSMutableSet.

Join { to automatically receive all group messages.