Graphic is disposed

Oxygen general issues.
Denis
Posts: 47
Joined: Thu Jun 19, 2014 3:55 pm

Graphic is disposed

Post by Denis »

Hi

we are using the Eclipse Oxygen Author in Version 15.2

I close a editor tab programmatically. Now I get a SWT.Exception back, which tells me the graphic is disposed.
It is difficult for me to debug, because I can not see which graphic will be disposed to early:

Code: Select all

Caused by: org.eclipse.swt.SWTException: Graphic is disposed
at org.eclipse.swt.SWT.error(SWT.java:4282)
at org.eclipse.swt.SWT.error(SWT.java:4197)
at org.eclipse.swt.SWT.error(SWT.java:4168)
at org.eclipse.swt.graphics.Resource.getDevice(Resource.java:81)
at com.oxygenxml.editor.editors.xsd.view.c.ab(Unknown Source)
at com.oxygenxml.editor.editors.xsd.view.c.u(Unknown Source)
at com.oxygenxml.editor.editors.xsd.view.c.<init>(Unknown Source)
at com.oxygenxml.editor.editors.author.s.lnw(Unknown Source)
at ro.sync.ecss.g.ac.rv(Unknown Source)
at ro.sync.ecss.g.ac.qv(Unknown Source)
at ro.sync.ecss.g.ac.ij(Unknown Source)
at ro.sync.ecss.g.u.ij(Unknown Source)
at ro.sync.ecss.g.q.ij(Unknown Source)
at ro.sync.ecss.g.u.ij(Unknown Source)
at ro.sync.ecss.g.q.ij(Unknown Source)
at ro.sync.ecss.g.u.ij(Unknown Source)
at ro.sync.ecss.g.mb.ij(Unknown Source)
at ro.sync.ecss.g.rb.ij(Unknown Source)
at ro.sync.ecss.g.e.ij(Unknown Source)
at ro.sync.ecss.g.e.ij(Unknown Source)
at ro.sync.ecss.g.nb.ij(Unknown Source)
at ro.sync.ecss.component.n.aii(Unknown Source)
at com.oxygenxml.editor.editors.author.s.uzw(Unknown Source)
at com.oxygenxml.editor.editors.author.s.xzw(Unknown Source)
at com.oxygenxml.editor.editors.author.s$10.caretMoved(Unknown Source)
at ro.sync.ecss.component.n.dbj(Unknown Source)
at ro.sync.ecss.component.n.faj(Unknown Source)
at ro.sync.ecss.component.n.oaj(Unknown Source)
at ro.sync.ecss.component.n.sii(Unknown Source)
at ro.sync.ecss.component.n.whi(Unknown Source)
at com.oxygenxml.editor.editors.author.AuthorEditorPage.restoreLastSavedPosition(Unknown Source)
at ro.sync.exml.l.c.b(Unknown Source)
at com.oxygenxml.editor.editors.xml.ob.checkForChange(Unknown Source)
at com.oxygenxml.editor.editors.author.AuthorEditorPage$15$1.run(Unknown Source)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
Is it possible, that on your side a graphic will be disposed to earyl?
Denis Zygann
KGU Consulting GmbH
http://www.kgu-consulting.com
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Graphic is disposed

Post by Radu »

Hi Denis,

What API exactly are you calling to close the editor?
It seems that while the editor is closing it somehow receives focus and checks if its contents has been modified on disk. The contents seem to be modified on disk since its last load (we look at the timestamp of the loaded file on disk) so the editor tries to use Display.getDefault().asyncExec in order to auto-reload from disk. But the editor has already been disposed so the reload fails.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Denis
Posts: 47
Joined: Thu Jun 19, 2014 3:55 pm

Re: Graphic is disposed

Post by Denis »

Hi Radu,

I use the

Code: Select all

closeEditors(IEditorReference[], boolean)
method from the

Code: Select all

IWorkbenchPage
.
Is there a watchdog on your side, which holds the file? And if how long he holds the file?

Best regards,
Denis
Denis Zygann
KGU Consulting GmbH
http://www.kgu-consulting.com
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Graphic is disposed

Post by Radu »

Hi Denis,

No, it's just a focus listener which if it detects that the file on disk has a newer timestamp than the file loaded in the editor will try to trigger a reload using Display.getDefault().asyncExec which in your case delays the execution until after the editor has been disposed. I tried to guard this situation, when Oxygen 16.1 comes out in a couple of days please try again to see if you can reproduce the situation.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply