Is there a way to close the NSComboBox popup programmatically?
There seem to be a bug with NSComboBox when the popup is open, and the control get's removed and then released. For some reason, the dealloc of the NSComboBox doesn't clear the popup before destructing.
Edit: Just to clarify - this bug only happens when the popup list is opened. Otherwise the control is released properly and cleanly.
Edit Edit: This is how to reproduce it.
- Create a new Cocoa application.
- Turn off automatic reference counting.
- In @(applicationDidFinishLaunching) create a new NSComboBox and store it to a member.
- Add the combo box to the window's contentView.
- Create a new menu item with a keyboard shortcut and bind to a selector.
- In the menu item's selector: remove the combo box from the view and release the member. Don't forget to set it back to nil.
- Run the application.
- Click on the combo box to show the popup up.
- Use the shortcut to remove the combo box.