Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#922: Possible NPE in Menu._setVisible #923

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ void menuDidClose(long id, long sel, long menu) {

@Override
void mouseDown(long id, long sel, long theEvent) {
// If the control is diposed in below 'super.mouseDown()', both fields
// If the control is disposed in below 'super.mouseDown()', both fields
// 'view' and 'display' will be nulled. Hence keep their references:
final Display display = this.display;
final NSView view = this.view;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ void _setVisible (boolean visible) {

// Hold on to window in case it is disposed while the popup is open.
window.retain();
// The menu might get disposed in a NS* call below (#922), so better
// keep a reference to `display` here.
final Display display = this.display;
// NSMenu processes events on its own while the popup is open.
display.sendPreExternalEventDispatchEvent ();
NSEvent nsEvent = NSEvent.otherEventWithType(OS.NSApplicationDefined, location, 0, 0.0, window.windowNumber(), window.graphicsContext(), (short)0, 0, 0);
Expand Down
Loading