twitter-archive / twui

A UI framework for Mac based on Core Animation
Other
2.74k stars 268 forks source link

Crash when window is released #124

Open zachwaugh opened 12 years ago

zachwaugh commented 12 years ago

I'm trying to track down a crash that occurs when a window is closed (and released) that contains a TwUI view hierarchy. From what I can tell, while a NSWindow is being dealloc'd, the TUINSView tries to clean up the hierarchy, which ends up accessing the window and causing the crash.

I'm not familiar enough with the TUIView internals to know the proper fix, but if I set the rootView of my TUINSView to nil before the window is released, it doesn't crash and every thing seems to work correctly. Here's a sample project that reproduces the crash - http://cl.ly/3R0J1k3d2f37, but you can also reproduce it in the example project by commenting out the setReleasedWhenClosed: calls in ExampleAppDelegate.m.