[Merkaartor] SEGV when opening geotagged images

Chris Browet cbro at semperpax.com
Tue May 5 10:17:37 BST 2009


Could you attach the gdb log?

Even if, for some strange reason, *it wouldn't be a QObject, it shouldn't
SEGV, just return a NULL pointer...

- Chris -

2009/5/4 Toby Speight <T.M.Speight.90 at cantab.net>

> I frequently get a segmentation fault when loading JPEG images.  I
> traced it down to this code:
>
> /--------
> |               if (positionValid) {
> |                       Coord newPos(angToInt(lat), angToInt(lon));
> |                       TrackPoint *Pt;
> |             QList<MapFeature*>::ConstIterator it =
> theLayer->get().constBegin();
> |             QList<MapFeature*>::ConstIterator end =
> theLayer->get().constEnd();
> |                       for (; it != end; it++) // use existing TrackPoint
> if there is one in small distance
> |                               if ((Pt = qobject_cast<TrackPoint*>(*it))
> &&
> |                                Pt->position().distanceFrom(newPos) <=
> .002)
> |                                       break;
> |                       if (it == end)
> |                               Pt = new TrackPoint(newPos);
> |
> |                       Pt->setTag("Picture", "GeoTagged");
> |                       usedTrackPoints << TrackPointData(Pt->id(), file,
> time, it == end);
> |                       //if (it == end)
> |                               theLayer->add(Pt);
> |                               //new AddFeatureCommand(theLayer, Pt,
> false);
> \--------
>
> Looking at the backtrace in gdb, it seems that the
> "qobject_cast<TrackPoint*>" sometimes fails, which I think means that
> *it isn't a valid QObject.  But I don't know how to investigate further.
>
> For now, my workaround is to disable the iteration, and always create
> new points, and that seems to make Merkaartor reliable again for me.
>
> _______________________________________________
> Merkaartor mailing list
> Merkaartor at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/merkaartor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/merkaartor/attachments/20090505/ea81ac5a/attachment.html>


More information about the Merkaartor mailing list