> On 21 May 2015, at 2:41 pm, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> It looks to me like the problem is that the NSWindowController’s “document” 
> property is still set to the NSDocument object that was just deallocated. I'm 
> surprised to see that the “document” property is ‘assign’ rather than 
> ‘strong’ (guess I never had a reason to look before).

I presume because the document owns its window controllers this must be weak to 
avoid a retain cycle.


> I don’t know if something in the NSDocument or NSWindowController machinery 
> is supposed to set “document” back to nil when the document closes, or when, 
> but apparently the fonts panel is causing traversal of the action event queue 
> in a timing window before that’s occurred. It then crashes because the window 
> controller is trying to make the (non-existent) document look like it’s in 
> the responder chain. This is a stale pointer problem, not an overrelease 
> problem, AFAICT.

Right. Forgive my sluggishness but I (eventually) arrived at this conclusion as 
well.


> You might be able to work around it by forcibly setting “document” to nil in 
> the window controller (say) when the window is closing, though I don’t know 
> what else that might interfere with. 

I have tried that, but the problem persists.

That makes me wonder whether the window here is NOT the document’s main window, 
but the Save Panel? Maybe a sandboxed save panel (being the bizarre object it 
is) keeps a reference to the document it was attached to, and that is what is 
stale? Is there a way to reveal the address/identity of a given object in 
Instruments? I see the NSWindow method in the stack trace, but it doesn’t tell 
me which window.

—Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to