Re: Re: NSTabViewItem and NSViewController

2019-04-04 Thread Casey McDermott
>> I see that NSTabViewItem has a strong viewController property. Are you >> using that, or does your NSTabViewItem >> subclass add its own separate reference to the view controller? >> --Andy Ah, we are using our own reference. That may be the problem. We set the view in the NSTabViewItem bu

Re: NSTabViewItem and NSViewController

2019-04-04 Thread Keary Suska
Re-reading my response, I hope it didn’t come across as snarky. If so, I apologize, as that wasn’t my intention. Anyway, I believe that it is expected behavior that a tab view item is released when it is removed, and in non-ARC environments that tends to mean a lot of autoreleasing, and xib-loa

Re: NSTabViewItem and NSViewController

2019-04-04 Thread Casey McDermott
The tab view item has a strong reference to the view controller, but the controller is released even though the tab view item still exists. So, selecting the tab hits the controller ref and it crashes with EXC_BAD_ACCESS. My guess is it's released when the NSTabView switches views, but a breakp

Re: NSTabViewItem and NSViewController

2019-04-04 Thread Andy Lee
On Apr 4, 2019, at 9:43 AM, Casey McDermott wrote: > > We have a tab view with tabs added from code. Each tab uses a NSTabViewItem > subclass, > which contains a reference to a NSViewController subclass within it to manage > tab contents. > Users click to add and remove tabs. I see that NSTa

Re: NSTabViewItem and NSViewController

2019-04-04 Thread Keary Suska
Who owns the view controller? Apparently, no-one, sine ARC is deallocating it once the last reference to it (the tab view item) is deallocated. If there is supposed to be an owner, make sure the owner’s reference is strong. If you can target 10.10+, using NSTabViewController is probably a better

NSTabViewItem and NSViewController

2019-04-04 Thread Casey McDermott
We have a tab view with tabs added from code. Each tab uses a NSTabViewItem subclass, which contains a reference to a NSViewController subclass within it to manage tab contents. Users click to add and remove tabs. It works fine without ARC, with the NSTabView controlling the viewer lifetime. W