Opened 16 years ago
Closed 16 years ago
#56 closed defect (fixed)
Fix SWTException during scrolling
Reported by: | Fabian Rohn | Owned by: | Fabian Rohn |
---|---|---|---|
Priority: | critical | Milestone: | MS1: First release (1.0.0) |
Component: | track | Version: | pre-1.0 |
Keywords: | SWTException | Cc: |
Description
Sometimes I reported some Exceptions, I could not reproduce. Now I believe I got it.
To reproduce it, you have to do the following steps:
- insert some tiles (straights and 60° turns)
- click with the left mouse button on a scroll item of the widget and hold it
- scroll a bit and move the mouse away from scroll item (by holding the mouse button)
- then the exeption occurs
Here the stacktrace:
12:31:44,406 ERROR unknown:42 - Failed to execute runnable (java.lang.NullPointerException) org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) at org.eclipse.swt.SWT.error(SWT.java:3773) at org.eclipse.swt.SWT.error(SWT.java:3691) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3759) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3384) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2394) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2358) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2210) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:494) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:489) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at de.jacavi.rcp.Application.start(Application.java:25) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:379) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) at org.eclipse.equinox.launcher.Main.main(Main.java:1212) Caused by: java.lang.NullPointerException at de.jacavi.rcp.widgets.TrackWidget.handleInnerControlClick(TrackWidget.java:477) at de.jacavi.rcp.widgets.TrackWidget.access$3(TrackWidget.java:476) at de.jacavi.rcp.widgets.TrackWidget$ClickEventRepetitionHandler$1.run(TrackWidget.java:239) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132) ... 23 more
Change History (6)
comment:1 Changed 16 years ago by
Status: | new → accepted |
---|
comment:2 Changed 16 years ago by
comment:3 Changed 16 years ago by
Owner: | changed from Henrik Heimbuerger to Fabian Rohn |
---|---|
Status: | accepted → assigned |
It should no longer be possible to trigger this problem. I'm assigning the issue back for testing. If it works, please close it. If not, please assign back.
comment:4 Changed 16 years ago by
Milestone: | MS2: Track editor available → MS1: First usable version |
---|
Batch moved all tickets from MS2 (track editor) to MS1 (first working version).
comment:5 Changed 16 years ago by
Component: | unspecified → track |
---|---|
Priority: | major → critical |
comment:6 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
New commit by hheimbuerger (revision [194]):
[Fix for ticket #56, partial fix for ticket #53] Fixed NullPointerException during scrolling.
I'm not entirely sure which race condition caused this, but in certain situations a NullPointerException was thrown when moving the cursor away from an inner TrackWidget control while holding it. It was somehow caused by the timer thread for the TimerTask ClickEventRepetitionHandler communicating with the event dispatcher thread over the field hoveredInnerControl. This problem was worked around by passing the current hoveredInnerControl into the ClickEventRepetitionHandler during construction. The ClickEventRepetitionHandler only works on its own state now and in the worst case invokes the requested change once more while the mouse button has already been released.
During investigation, another bug was found that caused the inner control clicks to be also checked for track section selections. That has been fixed, clicks on inner controls now have priority and the track selection change is only evaluated if no inner control click could be detected.
Additionally, the scrollers' click detection shape is now a little larger, making it easier to hit them. The previous shape was more exact (having the same shape as the scroller), but also did not take the brush width into account.