NSTextfield Does Not Resign First Responder on NSPopover Close

Originator:jonathantorrens425
Number:rdar://23383592 Date Originated:11/3/2015
Status:Open Resolved:
Product:OSX SDK Product Version:10.10.4
Classification:Crashes Reproducible:Always
 
Summary:
If you create an NSTextField inside an NSPopover, and have conditional code in the textfield's textShouldEndEditing delegate method, it is possible to dismiss the popover without the textfield resigning first responder. 

If this happens, the textfield remains first responder even after it, and the popover, have disappeared.  This will cause the App to crash as soon as another event is triggered.

Steps to Reproduce:
1. Create an interface that triggers the display of an NSPopver
2. Include an NSTextField inside the NSPopover.
3. Implement the NSTextField's control:textShouldEndEditing: delegate method; within this method, include code that would returns false under some condition.
4. If the control:textShouldEndEditing: returns false, and the NSPopover is dismissed, the NSTextField does not resign first responder.
5. Any subsequent event after the popover has been dismissed, will cause the app to crash.

Expected Results:
When the popover is dismiss, all of the controls it contains should resign first responder by default.

Actual Results:
The app crashes.

Version:
Xcode 6.4, 

Notes:


Configuration:
This error occurs on Yosemite 10.10.4

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!