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

"Device is disposed" in Clipboard.dispose() #181

Closed
jukzi opened this issue May 31, 2022 · 6 comments
Closed

"Device is disposed" in Clipboard.dispose() #181

jukzi opened this issue May 31, 2022 · 6 comments

Comments

@jukzi
Copy link
Contributor

jukzi commented May 31, 2022

happened on windows:

org.eclipse.e4.core.di.InjectionException: org.eclipse.swt.SWTException: Device is disposed
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:68)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:995)
	at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:452)
	at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:161)
	at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:83)
	at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:103)
	at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:68)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:163)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:163)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:163)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:163)
	at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:102)
	at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:144)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:944)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:229)
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:138)
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:130)
	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:217)
	at org.eclipse.osgi.container.Module.publishEvent(Module.java:499)
	at org.eclipse.osgi.container.Module.doStop(Module.java:658)
	at org.eclipse.osgi.container.Module.stop(Module.java:521)
	at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:207)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:226)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.eclipse.swt.SWTException: Device is disposed
	at org.eclipse.swt.SWT.error(SWT.java:4918)
	at org.eclipse.swt.SWT.error(SWT.java:4833)
	at org.eclipse.swt.SWT.error(SWT.java:4804)
	at org.eclipse.swt.widgets.Display.error(Display.java:1272)
	at org.eclipse.swt.widgets.Display.getThread(Display.java:2616)
	at org.eclipse.swt.dnd.Clipboard.dispose(Clipboard.java:219)
	at org.eclipse.tea.core.ui.live.internal.TaskingLiveView.dispose(TaskingLiveView.java:354)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	... 26 more
@akurtakov
Copy link
Member

This seems to originate from org.eclipse.tea.core.ui.live.internal.TaskingLiveView.dispose . Can you point to the source code for it?

@akurtakov
Copy link
Member

I have no idea what/when will call PreDestroy for but the usual pattern is
if (clipboard != null && !clipboard.isDisposed ()) clipboard.dispose (); . Otherwise second call to this method will always end up with such exception. If you think second call to this method should not happen (most likely!) there should be a fix needed elsewhere.

@akurtakov
Copy link
Member

Overall, I don't think there is not an SWT issue here, "double free" is still not solved problem.

@merks
Copy link
Contributor

merks commented May 31, 2022

@akurtakov Yes, my sense is that something disposed the Display early. The Clipboard.dispose looks this:

image

So we know the clipboard isn't null and isn't disposed. But the display is disposed. That's certainly not SWT's fault.

Someone who can reproduce this problem should put a breakpoint in the Display's dispose...

@jukzi jukzi closed this as not planned Won't fix, can't repro, duplicate, stale Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants