Skip to content

Edge: Widget disposed exceptions #392

@HeikoKlare

Description

@HeikoKlare

Some test runs failed in a very sporadic fail with the following stack trace:

org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:4946)
	at org.eclipse.swt.SWT.error(SWT.java:4861)
	at org.eclipse.swt.SWT.error(SWT.java:4832)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:507)
	at org.eclipse.swt.widgets.Widget.getDisplay(Widget.java:628)
	at org.eclipse.swt.browser.Edge.sendProgressCompleted(Edge.java:1172)
	at org.eclipse.swt.browser.Edge.lambda$44(Edge.java:1192)
	at org.eclipse.swt.browser.Edge$HandleCoreWebView2SwtCallback.Invoke(Edge.java:250)
	at org.eclipse.swt.internal.win32.OS.DestroyWindow(Native Method)
	at org.eclipse.swt.widgets.Control.destroyWidget(Control.java:740)
	at org.eclipse.swt.widgets.Shell.destroyWidget(Shell.java:728)
	at org.eclipse.swt.widgets.Widget.release(Widget.java:913)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:485)
	at org.eclipse.swt.widgets.Decorations.dispose(Decorations.java:376)
	at org.eclipse.test.Screenshots$ScreenshotOnFailure.dispose(Screenshots.java:57)
	at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Widget$1.dispose(Test_org_eclipse_swt_widgets_Widget.java:72)
	at org.eclipse.test.Screenshots$ScreenshotOnFailure.finished(Screenshots.java:47)

It seems like it might happen that an Edge instance is disposed but a registered completion callback is called after the disposal, which then tries to access browser.getDisplay().... but since browser is disposed this fails.

We should fix this place (and check for other such places) where a callback may access resources/controls that meanwhile may have been disposed. The solution will probably be to just check for the browser already being disposed and in that case to not do anything, as it's not necessary anymore.

The current behavior should not be problematic as it will only result in the callback not being executed which is what we want achieved anyway. But to avoid unnecessary logged exceptions and also avoid unintended side effects to the callback processing function, we should clean this up.

Metadata

Metadata

Assignees

Labels

HiDPIA HiDPI-Related Issue or FeatureSWTIssue for SWT

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions