Endless NPE on arrow keys
frankbenoit opened this issue · 3 comments
When i start the SimpleMindMapApplication and i use the keyboard arrow keys, left/right the view is moving left right. But after some key presses, the console prints endless stacktraces.
Is this an error in the application or in GEF?
I use GEF 5.0.1
....
at java.lang.Thread.run(Thread.java:745)
java.lang.NullPointerException
at org.eclipse.gef.mvc.fx.handlers.PanOnStrokeHandler.updateScrollPosition(PanOnStrokeHandler.java:272)
at org.eclipse.gef.mvc.fx.handlers.PanOnStrokeHandler$1.handle(PanOnStrokeHandler.java:163)
at javafx.animation.AnimationTimer$AnimationTimerReceiver.lambda$handle$484(AnimationTimer.java:57)
at java.security.AccessController.doPrivileged(Native Method)
at javafx.animation.AnimationTimer$AnimationTimerReceiver.handle(AnimationTimer.java:56)
at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:357)
at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:267)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:506)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
java.lang.NullPointerException
at org.eclipse.gef.mvc.fx.handlers.PanOnStrokeHandler.updateScrollPosition(PanOnStrokeHandler.java:272)
at org.eclipse.gef.mvc.fx.handlers.PanOnStrokeHandler$1.handle(PanOnStrokeHandler.java:163)
at javafx.animation.AnimationTimer$AnimationTimerReceiver.lambda$handle$484(AnimationTimer.java:57)
at java.security.AccessController.doPrivileged(Native Method)
at javafx.animation.AnimationTimer$AnimationTimerReceiver.handle(AnimationTimer.java:56)
at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:357)
at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:267)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:506)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
java.lang.NullPointerException
at org.eclipse.gef.mvc.fx.handlers.PanOnStrokeHandler.updateScrollPosition(PanOnStrokeHandler.java:272)
at org.eclipse.gef.mvc.fx.handlers.PanOnStrokeHandler$1.handle(PanOnStrokeHandler.java:163)
at javafx.animation.AnimationTimer$AnimationTimerReceiver.lambda$handle$484(AnimationTimer.java:57)
at java.security.AccessController.doPrivileged(Native Method)
at javafx.animation.AnimationTimer$AnimationTimerReceiver.handle(AnimationTimer.java:56)
at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:357)
at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:267)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:506)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
....
Thank you for reporting the issue!
I was looking into it and this should be a bug in GEF that only happens when panning is aborted due to the internal AnimationTimer not being stopped. The timer calls updateScrollPosition() leading to the exception. I created Bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=541744 to keep track of the issue.
In order to resolve the issue, we need to stop the AnimationTimer when the panning handler is aborted.
However, I wonder why the handler is aborted without the viewer losing focus. So you would need to verify if panning works for you or if it stops randomly (due to the handler being aborted).
I had a same issue.
It may be focus problem.
In my case, it was fixed by this commit.
nakag/gef5.mvc.examples@36c8d34#diff-02407d1b3cb61fdc2e841a0ea3dd0e8cR90