Skip to content

Commit 228b669

Browse files
committed
Check if disposed as otherwise we can't fetch the data
If the dispose event arrives after the widget has be disposed (e.g. on shutdown) then getData throws an exception. This now checks first if the widget is already disposed and then simply returns.
1 parent 066ac07 commit 228b669

File tree

1 file changed

+5
-2
lines changed
  • bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt

1 file changed

+5
-2
lines changed

bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SWTPartRenderer.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,11 @@ public void bindWidget(MUIElement me, Object widget) {
141141
// Ensure that disposed widgets are unbound form the model
142142
Widget swtWidget = (Widget) widget;
143143
swtWidget.addDisposeListener(e -> {
144-
MUIElement element = (MUIElement) e.widget
145-
.getData(OWNING_ME);
144+
Widget w = e.widget;
145+
if (w.isDisposed()) {
146+
return;
147+
}
148+
MUIElement element = (MUIElement) w.getData(OWNING_ME);
146149
if (element != null)
147150
unbindWidget(element);
148151
});

0 commit comments

Comments
 (0)