Skip to content

Commit

Permalink
SG-15889: SWT, macOS: ignore events for disposed widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Singer authored and tmssngr committed Mar 21, 2024
1 parent fbbce4b commit a9c8b23
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6091,15 +6091,19 @@ static long windowProc(long id, long sel) {
Widget widget = LookupWidget(id, sel);
if (widget == null) return 0;

if (sel == OS.sel_dealloc) {
widget.dealloc(id, sel);
return 0;
}

// might happen rarely and causes assertions later, e.g. https://bugs.eclipse.org/bugs/show_bug.cgi?id=436228
if (widget.display == null) return 0;

return switch (Selector.valueOf(sel)) {
case sel_sendSelection -> {
widget.sendSelection();
yield 0;
}
case sel_dealloc -> {
widget.dealloc(id, sel);
yield 0;
}
case sel_sendDoubleSelection -> {
widget.sendDoubleSelection();
yield 0;
Expand Down Expand Up @@ -6243,6 +6247,9 @@ static long windowProc(long id, long sel, long arg0) {
Widget widget = LookupWidget(id, sel);
if (widget == null) return 0;

// might happen rarely and causes assertions later, e.g. https://bugs.eclipse.org/bugs/show_bug.cgi?id=436228
if (widget.display == null) return 0;

return switch (Selector.valueOf(sel)) {
case sel_windowWillClose_ -> {
widget.windowWillClose(id, sel, arg0);
Expand Down

0 comments on commit a9c8b23

Please sign in to comment.