Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10269 closed defect (fixed)

Null deref in

Reported by: glebius Owned by: team
Priority: normal Milestone: 14.07
Component: Core Version:
Keywords: Cc:


Under certain circumstances trkPnt.customColoring is Null. To reproduce the problem, the following is required:

1) draw.rawgps.large=1
2) LiveGPSPlugin enabled and connected to gpsd. Hint: use gpsfake from gpsd package to reproduce on a computer without GPS receiver.

I haven't yet investigated the problem very good, but my current guess is the following: there is a race between GpxLayer.paint() and the LiveGPSPlugin adding new points to the GPX.

In line 552 there is cycle

for (Collection<WayPoint> segment : data.getLinesIterable(null))

, that adds customColoring to every trackpoint.

Later in line 631 we have same iterator that fills in visibleSegments linked list. And later in that list in line 755 we encounter a trackpoint without customColoring initialized. So, I guess, that between iterator in line 552 and iterator in line 631 the "data" is modified with new points.

Attachments (0)

Change History (17)

comment:1 Changed 5 years ago by glebius

Another possibility is that computeCacheInSync is true while should be false. This may lead to trackpoint w/o customColoring initialized.

comment:2 Changed 5 years ago by Don-vip

What's the operational impact? An exception, an absence of track coloring?

comment:3 Changed 5 years ago by anonymous

Exception, LiveGPSPlugin is unusable. A workaround is draw.rawgps.large=0.

comment:4 Changed 5 years ago by akks

Got and fixed this exception while refactoring GpxLayer (thought I introduced it but according to this ticket it was already here)

Should be fixed in 7319/josm, see #5662 (fixing regressions now).
Could you please try it again and close the ticket if fixed?

comment:5 Changed 5 years ago by Don-vip

Milestone: 14.07

comment:6 Changed 5 years ago by Don-vip

Owner: changed from team to glebius
Status: newneedinfo

comment:7 Changed 5 years ago by Don-vip

glebius can you please tell us if we can close this ticket? Thanks.

comment:8 Changed 5 years ago by glebius

A new instant failure in GpxLayer with LiveGPS (josm 7337, modules updated):

        at org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper.drawPoints(
        at org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper.drawAll(
        at org.openstreetmap.josm.gui.layer.GpxLayer.paint(
        at livegps.LiveGpsLayer.paint(
        at org.openstreetmap.josm.gui.MapView.paintLayer(
        at org.openstreetmap.josm.gui.MapView.paint(
        at javax.swing.JComponent.paintChildren(
        at javax.swing.JComponent.paint(
        at javax.swing.JComponent.paintChildren(
        at javax.swing.JSplitPane.paintChildren(
        at javax.swing.JComponent.paint(
        at javax.swing.JComponent.paintChildren(
        at javax.swing.JComponent.paint(
        at javax.swing.JComponent.paintToOffscreen(
        at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(
        at javax.swing.RepaintManager$PaintManager.paint(
        at javax.swing.RepaintManager.paint(
        at javax.swing.JComponent._paintImmediately(
        at javax.swing.JComponent.paintImmediately(
        at javax.swing.RepaintManager$
        at javax.swing.RepaintManager$
        at Method)
        at javax.swing.RepaintManager.paintDirtyRegions(
        at javax.swing.RepaintManager.paintDirtyRegions(
        at javax.swing.RepaintManager.prePaintDirtyRegions(
        at javax.swing.RepaintManager.access$1100(
        at javax.swing.RepaintManager$
        at java.awt.event.InvocationEvent.dispatch(
        at java.awt.EventQueue.dispatchEventImpl(
        at java.awt.EventQueue.access$200(
        at java.awt.EventQueue$
        at java.awt.EventQueue$
        at Method)
        at java.awt.EventQueue.dispatchEvent(
        at java.awt.EventDispatchThread.pumpOneEventForFilters(
        at java.awt.EventDispatchThread.pumpEventsForFilter(
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(
        at java.awt.EventDispatchThread.pumpEvents(
        at java.awt.EventDispatchThread.pumpEvents(

Several large GPX points are drawn before exception, thus I suppose, that original problem is fixed. Sorry, ENOTIME for more detailed analysis. Should I open new ticket or can we continue in this one?

Last edited 5 years ago by Don-vip (previous) (diff)

comment:9 Changed 5 years ago by Don-vip

Owner: changed from glebius to team
Status: needinfonew

it's ok to keep this one, thanks.

comment:10 Changed 5 years ago by Don-vip

In 7340/josm:

see #10269 - fix NPE (robustness. trkPnt.customColoring should probably not be null)

comment:11 Changed 5 years ago by Don-vip

The NPE is fixed but the root cause is probably at another place. akks, can you please have a look at it tomorrow? If I manage to fix the two other points on my TODO list, we could release the tested version on Tuesday morning I think :)

comment:12 Changed 5 years ago by glebius

Tested 7340. The crash is fixed, thanks!

However, now the GPX layer produced by LiveGPS plugin has a bug. Unless the entire GPS trace fits the mapping window, the trace blinks and is colored white. If the mapping window is zoomed to a larger area and the entire trace is visible, then problem goes away.

comment:13 Changed 5 years ago by Don-vip

Resolution: fixed
Status: newclosed

Thanks for the feedback.
I prefer to close this ticket now, can you please create a new one for remaining bugs? Thanks.

comment:14 Changed 5 years ago by akks

In 7345/josm:

see #10269: avoid null color values in GpxLayer for sure

comment:15 Changed 5 years ago by akks

Had not a chance to fix it in time... After looking to the code: the source of problem should be in LiveGPS - it creates new WayPoint objects with customColoring=null and the color cache is not updated every time (elsewhere it would be too slow). This gives coloring problems and previous NPEs.

I have no GPSd with emulated tracks and can not debug the plugin, unfortunately.

The last commit may help a little with strange color effects.

Last edited 5 years ago by akks (previous) (diff)

comment:16 Changed 5 years ago by glebius

New ticket with instructions to reproduce #10321. Let's continue discussion there.

comment:17 Changed 5 years ago by glebius

The last commit did help. Thanks, akks! Will close #10321.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.