NSWindow fails to keep a strong reference to windows when changing key status, resulting in crash.

Originator:rick
Number:rdar://22349817 Date Originated:2015-08-19
Status:Open Resolved:
Product:OS X Product Version:10.10.5
Classification:Crash Reproducible:Always
 
Summary:
If a window causes the last strong reference to itself to be released during the invocation of the -windowDidResignKey: method, then there's a likely (if not guaranteed) crash shortly after.

Steps to Reproduce:
1. Build and run the sample application
2. Click 'show'. This will show a window that upon losing key status will cause the app to drop all strong references to it.
3. Click the main window of the app such that the new window loses key status

Expected Results:
Second window disappears

Actual Results:
Crash. : 
2015-08-19 16:56:06.768 KeyWindowVanish[91999:10914746] *** -[NSWindow defaultButtonCell]: message sent to deallocated instance 0x6080001e1100

Version:
10.10.5 (14F27)

Notes:


Configuration:
All device configurations.

Attachments:
http://cl.ly/343n2v2x1O3F

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!