Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [draw2d] LightWeightSystem dispose
[draw2d] LightWeightSystem dispose [message #95662] Mon, 29 September 2003 04:15 Go to next message
Alexey Kharlamov is currently offline Alexey KharlamovFriend
Messages: 8
Registered: July 2009
Junior Member
Hi!
I have a problem with GEF viewer using LightweightSystem to show
content. When user closes the shell with viewer's control a
NullPointerException is raised. The source of problem is in the
LightweightSystem class that does not remove listeners from disposed
control. If there are other dispose listeners doing something with the
control their movements are dispatched to draw2d and a GEF domain. But at
that moment the control is disposed and any operations with it lead to
crash.I have written a little patch to correct the issue and I can
contribute it to the community. In any case I should like to be sure that
this will be corrected in the next release.

with best regards,
Alexey Harlamov
Enterra Inc.
Re: [draw2d] LightWeightSystem dispose [message #95886 is a reply to message #95662] Mon, 29 September 2003 18:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Could you please post both the stack trace, and the patch? Thanks!
What do you mean by "movements are dispatched"? Do you move the shell after
it is closed?

"Alexey Harlamov" <aharlamov@mail.ru> wrote in message
news:bl8bea$qsa$1@eclipse.org...
> Hi!
> I have a problem with GEF viewer using LightweightSystem to show
> content. When user closes the shell with viewer's control a
> NullPointerException is raised. The source of problem is in the
> LightweightSystem class that does not remove listeners from disposed
> control. If there are other dispose listeners doing something with the
> control their movements are dispatched to draw2d and a GEF domain. But at
> that moment the control is disposed and any operations with it lead to
> crash.I have written a little patch to correct the issue and I can
> contribute it to the community. In any case I should like to be sure that
> this will be corrected in the next release.
>
> with best regards,
> Alexey Harlamov
> Enterra Inc.
>
>
Re: [draw2d] LightWeightSystem dispose [message #96088 is a reply to message #95886] Tue, 30 September 2003 06:15 Go to previous messageGo to next message
Alexey Kharlamov is currently offline Alexey KharlamovFriend
Messages: 8
Registered: July 2009
Junior Member
"Randy Hudson" <none@us.ibm.com> wrote in message
news:bl9vau$g2r$1@eclipse.org...
> Could you please post both the stack trace, and the patch? Thanks!
> What do you mean by "movements are dispatched"? Do you move the shell
after
> it is closed?
No, I don't. Underling UI library moves focus from the disposing control
to another.
The atteached patch adds dispose listener to the control and removes
listeners on a dispose event.
Here is a stack trace as you have asked:

Error in testVisual(com.enterra.gluon.visual.EditorTestCase)
exception: java.lang.NullPointerException
java.lang.NullPointerException
at org.eclipse.gef.tools.AbstractTool.setViewer(AbstractTool.ja va:1196)
at org.eclipse.gef.tools.AbstractTool.focusLost(AbstractTool.ja va:405)
at org.eclipse.gef.EditDomain.focusLost(EditDomain.java:89)
at
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchFocus Lost(DomainEvent
Dispatcher.java:217)
at
org.eclipse.draw2d.LightweightSystem$EventHandler.focusLost( LightweightSyste
m.java:379)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:108)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :81)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:865)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:845)
at org.eclipse.swt.widgets.Control.WM_KILLFOCUS(Control.java:34 42)
at org.eclipse.swt.widgets.Canvas.WM_KILLFOCUS(Canvas.java:209)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:2797 )
at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
at org.eclipse.swt.internal.win32.OS.SetParent(Native Method)
at org.eclipse.swt.widgets.Control.setParent(Control.java:2754)
at com.enterra.ui.util.ControlUtilities.reparent(ControlUtiliti es.java:170)
at com.enterra.ui.controls.XComposite.onControlRemoved(XComposi te.java:277)
at com.enterra.ui.controls.XComposite$1.removed(XComposite.java :437)
at com.enterra.ui.util.BaseCollection.fireRemoved(BaseCollectio n.java:297)
at com.enterra.ui.util.BaseCollection.remove(BaseCollection.jav a:65)
at com.enterra.ui.util.BaseCollection.remove(BaseCollection.jav a:189)
at
com.enterra.ui.controls.ControlCollection.remove(ControlColl ection.java:103)
at com.enterra.ui.controls.XComposite$2.handleEvent(XComposite. java:465)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :81)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:865)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:845)
at org.eclipse.swt.widgets.Widget.releaseWidget(Widget.java:750 )
at org.eclipse.swt.widgets.Control.releaseWidget(Control.java:1 407)
at org.eclipse.swt.widgets.Scrollable.releaseWidget(Scrollable. java:188)
at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:368)
at org.eclipse.swt.widgets.Canvas.releaseWidget(Canvas.java:118 )
at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
at org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
at org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
at org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
at org.eclipse.swt.widgets.Canvas.releaseWidget(Canvas.java:118 )
at org.eclipse.swt.widgets.Decorations.releaseWidget(Decoration s.java:615)
at org.eclipse.swt.widgets.Shell.releaseWidget(Shell.java:709)
at org.eclipse.swt.widgets.Widget.dispose(Widget.java:372)
at org.eclipse.swt.widgets.Shell.dispose(Shell.java:472)
at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.jav a:1279)
at org.eclipse.swt.widgets.Shell.WM_CLOSE(Shell.java:1175)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:2771 )
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1298 )
at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable .java:77)
at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:394)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:2845 )
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1298 )
at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable .java:77)
at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:394)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:2845 )
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:13 03)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1543)
at com.enterra.gluon.GluonTestBase.dispatchEvents(GluonTestBase .java:69)
at
com.enterra.gluon.visual.VisualTestCase.testVisual(VisualTes tCase.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
..java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.jav a:319)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.jav a:198)
at
org.eclipse.test.CoreTestApplication.runTests(CoreTestApplic ation.java:34)
at org.eclipse.test.CoreTestApplication.run(CoreTestApplication .java:30)
at
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
a:858)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
..java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:291)
at org.eclipse.core.launcher.Main.run(Main.java:747)
at org.eclipse.core.launcher.Main.main(Main.java:583)

> "Alexey Harlamov" <aharlamov@mail.ru> wrote in message
> news:bl8bea$qsa$1@eclipse.org...
> > Hi!
> > I have a problem with GEF viewer using LightweightSystem to show
> > content. When user closes the shell with viewer's control a
> > NullPointerException is raised. The source of problem is in the
> > LightweightSystem class that does not remove listeners from disposed
> > control. If there are other dispose listeners doing something with the
> > control their movements are dispatched to draw2d and a GEF domain. But
at
> > that moment the control is disposed and any operations with it lead to
> > crash.I have written a little patch to correct the issue and I can
> > contribute it to the community. In any case I should like to be sure
that
> > this will be corrected in the next release.
> >
> > with best regards,
> > Alexey Harlamov
> > Enterra Inc.


  • Attachment: lws.patch
    (Size: 3.71KB, Downloaded 218 times)
Re: [draw2d] LightWeightSystem dispose [message #96296 is a reply to message #96088] Tue, 30 September 2003 17:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This could be several things. First, the focus lost event should come
before the dispose finished. Perhaps there is an inconsistency on motif
which causes this problem. Can you reproduce it on Win32??

A workaround to this problem is to do what we do in GraphicalEditor. When
the editor is closed, set the active tool to Null on the EditDomain. This
happens before the controls are disposed, I think.

"Alexey Harlamov" <aharlamov@mail.ru> wrote in message
news:blb6s2$j1s$1@eclipse.org...
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:bl9vau$g2r$1@eclipse.org...
> > Could you please post both the stack trace, and the patch? Thanks!
> > What do you mean by "movements are dispatched"? Do you move the shell
> after
> > it is closed?
> No, I don't. Underling UI library moves focus from the disposing
control
> to another.
> The atteached patch adds dispose listener to the control and removes
> listeners on a dispose event.
> Here is a stack trace as you have asked:
>
> Error in testVisual(com.enterra.gluon.visual.EditorTestCase)
> exception: java.lang.NullPointerException
> java.lang.NullPointerException
> at org.eclipse.gef.tools.AbstractTool.setViewer(AbstractTool.ja va:1196)
> at org.eclipse.gef.tools.AbstractTool.focusLost(AbstractTool.ja va:405)
> at org.eclipse.gef.EditDomain.focusLost(EditDomain.java:89)
> at
>
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchFocus Lost(DomainEvent
> Dispatcher.java:217)
> at
>
org.eclipse.draw2d.LightweightSystem$EventHandler.focusLost( LightweightSyste
> m.java:379)
> at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:108)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :81)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:865)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:845)
> at org.eclipse.swt.widgets.Control.WM_KILLFOCUS(Control.java:34 42)
> at org.eclipse.swt.widgets.Canvas.WM_KILLFOCUS(Canvas.java:209)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java:2797 )
> at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> at org.eclipse.swt.internal.win32.OS.SetParent(Native Method)
> at org.eclipse.swt.widgets.Control.setParent(Control.java:2754)
> at
com.enterra.ui.util.ControlUtilities.reparent(ControlUtiliti es.java:170)
> at
com.enterra.ui.controls.XComposite.onControlRemoved(XComposi te.java:277)
> at com.enterra.ui.controls.XComposite$1.removed(XComposite.java :437)
> at com.enterra.ui.util.BaseCollection.fireRemoved(BaseCollectio n.java:297)
> at com.enterra.ui.util.BaseCollection.remove(BaseCollection.jav a:65)
> at com.enterra.ui.util.BaseCollection.remove(BaseCollection.jav a:189)
> at
>
com.enterra.ui.controls.ControlCollection.remove(ControlColl ection.java:103)
> at com.enterra.ui.controls.XComposite$2.handleEvent(XComposite. java:465)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :81)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:865)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:845)
> at org.eclipse.swt.widgets.Widget.releaseWidget(Widget.java:750 )
> at org.eclipse.swt.widgets.Control.releaseWidget(Control.java:1 407)
> at org.eclipse.swt.widgets.Scrollable.releaseWidget(Scrollable. java:188)
> at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:368)
> at org.eclipse.swt.widgets.Canvas.releaseWidget(Canvas.java:118 )
> at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
> at org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
> at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
> at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
> at org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
> at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
> at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
> at org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
> at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
> at org.eclipse.swt.widgets.Canvas.releaseWidget(Canvas.java:118 )
> at org.eclipse.swt.widgets.Decorations.releaseWidget(Decoration s.java:615)
> at org.eclipse.swt.widgets.Shell.releaseWidget(Shell.java:709)
> at org.eclipse.swt.widgets.Widget.dispose(Widget.java:372)
> at org.eclipse.swt.widgets.Shell.dispose(Shell.java:472)
> at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.jav a:1279)
> at org.eclipse.swt.widgets.Shell.WM_CLOSE(Shell.java:1175)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java:2771 )
> at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
> at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
> at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1298 )
> at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable .java:77)
> at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:394)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java:2845 )
> at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
> at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
> at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1298 )
> at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable .java:77)
> at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:394)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java:2845 )
> at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
> at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:13 03)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1543)
> at com.enterra.gluon.GluonTestBase.dispatchEvents(GluonTestBase .java:69)
> at
> com.enterra.gluon.visual.VisualTestCase.testVisual(VisualTes tCase.java:28)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
> )
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.jav a:319)
> at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.jav a:198)
> at
> org.eclipse.test.CoreTestApplication.runTests(CoreTestApplic ation.java:34)
> at org.eclipse.test.CoreTestApplication.run(CoreTestApplication .java:30)
> at
>
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
> a:858)
> at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
> )
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:291)
> at org.eclipse.core.launcher.Main.run(Main.java:747)
> at org.eclipse.core.launcher.Main.main(Main.java:583)
>
> > "Alexey Harlamov" <aharlamov@mail.ru> wrote in message
> > news:bl8bea$qsa$1@eclipse.org...
> > > Hi!
> > > I have a problem with GEF viewer using LightweightSystem to show
> > > content. When user closes the shell with viewer's control a
> > > NullPointerException is raised. The source of problem is in the
> > > LightweightSystem class that does not remove listeners from disposed
> > > control. If there are other dispose listeners doing something with the
> > > control their movements are dispatched to draw2d and a GEF domain. But
> at
> > > that moment the control is disposed and any operations with it lead to
> > > crash.I have written a little patch to correct the issue and I can
> > > contribute it to the community. In any case I should like to be sure
> that
> > > this will be corrected in the next release.
> > >
> > > with best regards,
> > > Alexey Harlamov
> > > Enterra Inc.
>
>
>
Re: [draw2d] LightWeightSystem dispose [message #96739 is a reply to message #96296] Thu, 02 October 2003 03:35 Go to previous messageGo to next message
Alexey Kharlamov is currently offline Alexey KharlamovFriend
Messages: 8
Registered: July 2009
Junior Member
This problem arises on the Win32 platform. And yes, the focus lost event
comes before
the dispose finish. Let me explain the sequence of events that leads to the
exception.
First, user closes a window with the viewer. The Viewer receives the
widgetDisposed event
and sets controls to null. After that other dispose listeners are called.
One of them moves
focus to another control. At that moment the focus lost event are dispatched
to the EditDomain and
the viewer. But viewer's contol has been nulled already. And we have a
NullPointerException.

"Randy Hudson" <none@us.ibm.com> wrote in message
news:blceha$slc$2@eclipse.org...
> This could be several things. First, the focus lost event should come
> before the dispose finished. Perhaps there is an inconsistency on motif
> which causes this problem. Can you reproduce it on Win32??
>
> A workaround to this problem is to do what we do in GraphicalEditor. When
> the editor is closed, set the active tool to Null on the EditDomain. This
> happens before the controls are disposed, I think.
>
> "Alexey Harlamov" <aharlamov@mail.ru> wrote in message
> news:blb6s2$j1s$1@eclipse.org...
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:bl9vau$g2r$1@eclipse.org...
> > > Could you please post both the stack trace, and the patch? Thanks!
> > > What do you mean by "movements are dispatched"? Do you move the shell
> > after
> > > it is closed?
> > No, I don't. Underling UI library moves focus from the disposing
> control
> > to another.
> > The atteached patch adds dispose listener to the control and removes
> > listeners on a dispose event.
> > Here is a stack trace as you have asked:
> >
> > Error in testVisual(com.enterra.gluon.visual.EditorTestCase)
> > exception: java.lang.NullPointerException
> > java.lang.NullPointerException
> > at org.eclipse.gef.tools.AbstractTool.setViewer(AbstractTool.ja va:1196)
> > at org.eclipse.gef.tools.AbstractTool.focusLost(AbstractTool.ja va:405)
> > at org.eclipse.gef.EditDomain.focusLost(EditDomain.java:89)
> > at
> >
>
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchFocus Lost(DomainEvent
> > Dispatcher.java:217)
> > at
> >
>
org.eclipse.draw2d.LightweightSystem$EventHandler.focusLost( LightweightSyste
> > m.java:379)
> > at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:108)
> > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :81)
> > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
> > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:865)
> > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:845)
> > at org.eclipse.swt.widgets.Control.WM_KILLFOCUS(Control.java:34 42)
> > at org.eclipse.swt.widgets.Canvas.WM_KILLFOCUS(Canvas.java:209)
> > at org.eclipse.swt.widgets.Control.windowProc(Control.java:2797 )
> > at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> > at org.eclipse.swt.internal.win32.OS.SetParent(Native Method)
> > at org.eclipse.swt.widgets.Control.setParent(Control.java:2754)
> > at
> com.enterra.ui.util.ControlUtilities.reparent(ControlUtiliti es.java:170)
> > at
> com.enterra.ui.controls.XComposite.onControlRemoved(XComposi te.java:277)
> > at com.enterra.ui.controls.XComposite$1.removed(XComposite.java :437)
> > at
com.enterra.ui.util.BaseCollection.fireRemoved(BaseCollectio n.java:297)
> > at com.enterra.ui.util.BaseCollection.remove(BaseCollection.jav a:65)
> > at com.enterra.ui.util.BaseCollection.remove(BaseCollection.jav a:189)
> > at
> >
>
com.enterra.ui.controls.ControlCollection.remove(ControlColl ection.java:103)
> > at com.enterra.ui.controls.XComposite$2.handleEvent(XComposite. java:465)
> > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :81)
> > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
> > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:865)
> > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:845)
> > at org.eclipse.swt.widgets.Widget.releaseWidget(Widget.java:750 )
> > at org.eclipse.swt.widgets.Control.releaseWidget(Control.java:1 407)
> > at org.eclipse.swt.widgets.Scrollable.releaseWidget(Scrollable. java:188)
> > at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:368)
> > at org.eclipse.swt.widgets.Canvas.releaseWidget(Canvas.java:118 )
> > at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
> > at org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
> > at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
> > at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
> > at org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
> > at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
> > at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
> > at org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
> > at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
> > at org.eclipse.swt.widgets.Canvas.releaseWidget(Canvas.java:118 )
> > at
org.eclipse.swt.widgets.Decorations.releaseWidget(Decoration s.java:615)
> > at org.eclipse.swt.widgets.Shell.releaseWidget(Shell.java:709)
> > at org.eclipse.swt.widgets.Widget.dispose(Widget.java:372)
> > at org.eclipse.swt.widgets.Shell.dispose(Shell.java:472)
> > at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.jav a:1279)
> > at org.eclipse.swt.widgets.Shell.WM_CLOSE(Shell.java:1175)
> > at org.eclipse.swt.widgets.Control.windowProc(Control.java:2771 )
> > at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
> > at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> > at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
> > at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1298 )
> > at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable .java:77)
> > at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:394)
> > at org.eclipse.swt.widgets.Control.windowProc(Control.java:2845 )
> > at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
> > at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> > at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
> > at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1298 )
> > at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable .java:77)
> > at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:394)
> > at org.eclipse.swt.widgets.Control.windowProc(Control.java:2845 )
> > at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
> > at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> > at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
> > at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:13 03)
> > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1543)
> > at com.enterra.gluon.GluonTestBase.dispatchEvents(GluonTestBase .java:69)
> > at
> >
com.enterra.gluon.visual.VisualTestCase.testVisual(VisualTes tCase.java:28)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
> > )
> > at
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
> > .java:25)
> > at java.lang.reflect.Method.invoke(Method.java:324)
> > at junit.framework.TestCase.runTest(TestCase.java:154)
> > at junit.framework.TestCase.runBare(TestCase.java:127)
> > at junit.framework.TestResult$1.protect(TestResult.java:106)
> > at junit.framework.TestResult.runProtected(TestResult.java:124)
> > at junit.framework.TestResult.run(TestResult.java:109)
> > at junit.framework.TestCase.run(TestCase.java:118)
> > at junit.framework.TestSuite.runTest(TestSuite.java:208)
> > at junit.framework.TestSuite.run(TestSuite.java:203)
> > at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.jav a:319)
> > at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.jav a:198)
> > at
> >
org.eclipse.test.CoreTestApplication.runTests(CoreTestApplic ation.java:34)
> > at org.eclipse.test.CoreTestApplication.run(CoreTestApplication .java:30)
> > at
> >
>
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
> > a:858)
> > at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
> > )
> > at
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
> > .java:25)
> > at java.lang.reflect.Method.invoke(Method.java:324)
> > at org.eclipse.core.launcher.Main.basicRun(Main.java:291)
> > at org.eclipse.core.launcher.Main.run(Main.java:747)
> > at org.eclipse.core.launcher.Main.main(Main.java:583)
> >
> > > "Alexey Harlamov" <aharlamov@mail.ru> wrote in message
> > > news:bl8bea$qsa$1@eclipse.org...
> > > > Hi!
> > > > I have a problem with GEF viewer using LightweightSystem to show
> > > > content. When user closes the shell with viewer's control a
> > > > NullPointerException is raised. The source of problem is in the
> > > > LightweightSystem class that does not remove listeners from disposed
> > > > control. If there are other dispose listeners doing something with
the
> > > > control their movements are dispatched to draw2d and a GEF domain.
But
> > at
> > > > that moment the control is disposed and any operations with it lead
to
> > > > crash.I have written a little patch to correct the issue and I can
> > > > contribute it to the community. In any case I should like to be sure
> > that
> > > > this will be corrected in the next release.
> > > >
> > > > with best regards,
> > > > Alexey Harlamov
> > > > Enterra Inc.
> >
> >
> >
>
>
Re: [draw2d] LightWeightSystem dispose [message #96846 is a reply to message #96739] Thu, 02 October 2003 14:01 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I don't see why SWT would send out events on a Control which has already
been disposed. You contradicted yourself. You said the focus lost comes
first, but then you said the dispose listeners are called first. My
definition of "dispose" is when notification occurs, not when the method
returns.

The workaround is still the same. Set the active tool to NULL.

So, here's a question. If the TreeViewer is in the outline and has focus,
and I close the Outline View, causing both dispose and focus lost events,
does this problem still occur? Is it unique to disposing Shells?

"Alexey Harlamov" <aharlamov@mail.ru> wrote in message
news:blg67g$rni$1@eclipse.org...
> This problem arises on the Win32 platform. And yes, the focus lost event
> comes before
> the dispose finish. Let me explain the sequence of events that leads to
the
> exception.
> First, user closes a window with the viewer. The Viewer receives the
> widgetDisposed event
> and sets controls to null. After that other dispose listeners are called.
> One of them moves
> focus to another control. At that moment the focus lost event are
dispatched
> to the EditDomain and
> the viewer. But viewer's contol has been nulled already. And we have a
> NullPointerException.
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:blceha$slc$2@eclipse.org...
> > This could be several things. First, the focus lost event should come
> > before the dispose finished. Perhaps there is an inconsistency on motif
> > which causes this problem. Can you reproduce it on Win32??
> >
> > A workaround to this problem is to do what we do in GraphicalEditor.
When
> > the editor is closed, set the active tool to Null on the EditDomain.
This
> > happens before the controls are disposed, I think.
> >
> > "Alexey Harlamov" <aharlamov@mail.ru> wrote in message
> > news:blb6s2$j1s$1@eclipse.org...
> > >
> > > "Randy Hudson" <none@us.ibm.com> wrote in message
> > > news:bl9vau$g2r$1@eclipse.org...
> > > > Could you please post both the stack trace, and the patch? Thanks!
> > > > What do you mean by "movements are dispatched"? Do you move the
shell
> > > after
> > > > it is closed?
> > > No, I don't. Underling UI library moves focus from the disposing
> > control
> > > to another.
> > > The atteached patch adds dispose listener to the control and removes
> > > listeners on a dispose event.
> > > Here is a stack trace as you have asked:
> > >
> > > Error in testVisual(com.enterra.gluon.visual.EditorTestCase)
> > > exception: java.lang.NullPointerException
> > > java.lang.NullPointerException
> > > at
org.eclipse.gef.tools.AbstractTool.setViewer(AbstractTool.ja va:1196)
> > > at org.eclipse.gef.tools.AbstractTool.focusLost(AbstractTool.ja va:405)
> > > at org.eclipse.gef.EditDomain.focusLost(EditDomain.java:89)
> > > at
> > >
> >
>
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchFocus Lost(DomainEvent
> > > Dispatcher.java:217)
> > > at
> > >
> >
>
org.eclipse.draw2d.LightweightSystem$EventHandler.focusLost( LightweightSyste
> > > m.java:379)
> > > at
> >
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:108)
> > > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :81)
> > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
> > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:865)
> > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:845)
> > > at org.eclipse.swt.widgets.Control.WM_KILLFOCUS(Control.java:34 42)
> > > at org.eclipse.swt.widgets.Canvas.WM_KILLFOCUS(Canvas.java:209)
> > > at org.eclipse.swt.widgets.Control.windowProc(Control.java:2797 )
> > > at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> > > at org.eclipse.swt.internal.win32.OS.SetParent(Native Method)
> > > at org.eclipse.swt.widgets.Control.setParent(Control.java:2754)
> > > at
> > com.enterra.ui.util.ControlUtilities.reparent(ControlUtiliti es.java:170)
> > > at
> > com.enterra.ui.controls.XComposite.onControlRemoved(XComposi te.java:277)
> > > at com.enterra.ui.controls.XComposite$1.removed(XComposite.java :437)
> > > at
> com.enterra.ui.util.BaseCollection.fireRemoved(BaseCollectio n.java:297)
> > > at com.enterra.ui.util.BaseCollection.remove(BaseCollection.jav a:65)
> > > at com.enterra.ui.util.BaseCollection.remove(BaseCollection.jav a:189)
> > > at
> > >
> >
>
com.enterra.ui.controls.ControlCollection.remove(ControlColl ection.java:103)
> > > at
com.enterra.ui.controls.XComposite$2.handleEvent(XComposite. java:465)
> > > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :81)
> > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
> > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:865)
> > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:845)
> > > at org.eclipse.swt.widgets.Widget.releaseWidget(Widget.java:750 )
> > > at org.eclipse.swt.widgets.Control.releaseWidget(Control.java:1 407)
> > > at
org.eclipse.swt.widgets.Scrollable.releaseWidget(Scrollable. java:188)
> > > at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:368)
> > > at org.eclipse.swt.widgets.Canvas.releaseWidget(Canvas.java:118 )
> > > at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
> > > at
org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
> > > at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
> > > at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
> > > at
org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
> > > at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
> > > at org.eclipse.swt.widgets.Widget.releaseResources(Widget.java: 715)
> > > at
org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:319)
> > > at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.ja va:367)
> > > at org.eclipse.swt.widgets.Canvas.releaseWidget(Canvas.java:118 )
> > > at
> org.eclipse.swt.widgets.Decorations.releaseWidget(Decoration s.java:615)
> > > at org.eclipse.swt.widgets.Shell.releaseWidget(Shell.java:709)
> > > at org.eclipse.swt.widgets.Widget.dispose(Widget.java:372)
> > > at org.eclipse.swt.widgets.Shell.dispose(Shell.java:472)
> > > at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.jav a:1279)
> > > at org.eclipse.swt.widgets.Shell.WM_CLOSE(Shell.java:1175)
> > > at org.eclipse.swt.widgets.Control.windowProc(Control.java:2771 )
> > > at
org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
> > > at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> > > at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
> > > at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1298 )
> > > at
org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable .java:77)
> > > at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:394)
> > > at org.eclipse.swt.widgets.Control.windowProc(Control.java:2845 )
> > > at
org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
> > > at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> > > at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
> > > at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1298 )
> > > at
org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable .java:77)
> > > at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:394)
> > > at org.eclipse.swt.widgets.Control.windowProc(Control.java:2845 )
> > > at
org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1229)
> > > at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361 )
> > > at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
> > > at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:13 03)
> > > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1543)
> > > at
com.enterra.gluon.GluonTestBase.dispatchEvents(GluonTestBase .java:69)
> > > at
> > >
> com.enterra.gluon.visual.VisualTestCase.testVisual(VisualTes tCase.java:28)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > >
> >
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
> > > )
> > > at
> > >
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
> > > .java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:324)
> > > at junit.framework.TestCase.runTest(TestCase.java:154)
> > > at junit.framework.TestCase.runBare(TestCase.java:127)
> > > at junit.framework.TestResult$1.protect(TestResult.java:106)
> > > at junit.framework.TestResult.runProtected(TestResult.java:124)
> > > at junit.framework.TestResult.run(TestResult.java:109)
> > > at junit.framework.TestCase.run(TestCase.java:118)
> > > at junit.framework.TestSuite.runTest(TestSuite.java:208)
> > > at junit.framework.TestSuite.run(TestSuite.java:203)
> > > at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.jav a:319)
> > > at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.jav a:198)
> > > at
> > >
> org.eclipse.test.CoreTestApplication.runTests(CoreTestApplic ation.java:34)
> > > at
org.eclipse.test.CoreTestApplication.run(CoreTestApplication .java:30)
> > > at
> > >
> >
>
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
> > > a:858)
> > > at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > >
> >
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
> > > )
> > > at
> > >
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
> > > .java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:324)
> > > at org.eclipse.core.launcher.Main.basicRun(Main.java:291)
> > > at org.eclipse.core.launcher.Main.run(Main.java:747)
> > > at org.eclipse.core.launcher.Main.main(Main.java:583)
> > >
> > > > "Alexey Harlamov" <aharlamov@mail.ru> wrote in message
> > > > news:bl8bea$qsa$1@eclipse.org...
> > > > > Hi!
> > > > > I have a problem with GEF viewer using LightweightSystem to
show
> > > > > content. When user closes the shell with viewer's control a
> > > > > NullPointerException is raised. The source of problem is in the
> > > > > LightweightSystem class that does not remove listeners from
disposed
> > > > > control. If there are other dispose listeners doing something with
> the
> > > > > control their movements are dispatched to draw2d and a GEF domain.
> But
> > > at
> > > > > that moment the control is disposed and any operations with it
lead
> to
> > > > > crash.I have written a little patch to correct the issue and I can
> > > > > contribute it to the community. In any case I should like to be
sure
> > > that
> > > > > this will be corrected in the next release.
> > > > >
> > > > > with best regards,
> > > > > Alexey Harlamov
> > > > > Enterra Inc.
> > >
> > >
> > >
> >
> >
>
>
Previous Topic:Layering the icons
Next Topic:Logic Designer's part creation in XYLayout??
Goto Forum:
  


Current Time: Sun Jul 07 09:27:46 GMT 2024

Powered by FUDForum. Page generated in 0.05984 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top