mapper icon indicating copy to clipboard operation
mapper copied to clipboard

Area object triggers crash when selected

Open rem-maps opened this issue 2 years ago • 7 comments

I have an area object (a small yellow area - a triangle of open land) that triggers a crash in Mapper

Steps to reproduce

  1. Select the yellow area
  2. or use shift to append a line to the yellow area
  3. or cut away cutout when yellow area is inside the cutout line

Configuration

Mapper Version: 0.9.4 and 0.9.5 Operating System: Windows 7 Pro

I have stripped bare the file to see the code easily (one colour - one symbol - no templates) - attached here

this is the yellow area object xml code: image

As I was stuck (I couldn't use a big file anymore during a mapping job residency), I have 'cleaned' the original file removing by hand the tag in the xml and replacing objects count="3289" with objects count="3288" (one object less) I couldn't think of something else as I couldn't select the object in Mapper to delete it. Developers, is this a correct procedure or can it lead to problems? thanks a lot

prova_giallo2.zip

rem-maps avatar Mar 10 '22 18:03 rem-maps

@rem-maps: thank you for providing this issue report.

I drew a new map with a triangle area and searched for the difference. It seems that the additional '18' in the first coordinates cause the crash: if I remove it in your map, then everything is fine. If I add it to my map, it crashes as well. I need to look into the code to understand the meaning of this additional number. Still the question arises how this number made its way into your map file.

dl3sdo avatar Mar 10 '22 20:03 dl3sdo

and studying a bit more the xml now I see the shape is not a triangle as I previouslly said, but in fact it has 4 corners (maybe not important but anyway...) and I see that extra number (18) in other files comes out often with these numbers used: 1 16 18 32 33 48 50

rem-maps avatar Mar 10 '22 20:03 rem-maps

The values are the result of a bit pattern defined in https://github.com/OpenOrienteering/mapper/blob/master/src/core/map_coord.h The 18 is built from the HolePoint (16) flag and the ClosePoint (2) flag: "If this flag is set for the last point of a path, this path is treated as closed. The point's coordinates must be equal to the first point's coordinates in this path." So, while the ClosePoint flag is required for the last point, it certainly is forbidden for the start point.

dl3sdo avatar Mar 10 '22 21:03 dl3sdo

I tried to remember what I did drawing that shape but nothing special. I just recall having deleted a brown triangle in the same area but then I don't remember more than this. I tried to get older versions of the file but I didn't find any clue. (I have google drive backup so just a couple of files a day) Something definitely happened, maybe the process wasn't as smooth as always: I drew something, later deleted and re-drew it again, but nothing too much suspicious for a very frequent Mapper user. So I don't think I can help more than this.

If it is a glitch it's happening for the first time to me in more than 25 months of almost daily usage of Mapper, so hugely acceptable.

rem-maps avatar Mar 11 '22 08:03 rem-maps

Thanks for the report, Remo!

> As I was stuck (I couldn't use a big file anymore during a mapping job residency), I have 'cleaned' the original file removing by hand the tag in the xml and replacing objects count="3289" with objects count="3288" (one object less) I couldn't think of something else as I couldn't select the object in Mapper to delete it.

You are a brave man!

> Developers, is this a correct procedure or can it lead to problems?

Yes, that's a valid procedure and I wouldn't expect any problems with it.

As a side note, the object count is currently auxiliary information that helps Mapper allocate enough memory for the map objects. Even if you set it to a wrong number, Mapper reads all the objects for the map part and readjust the memory storage on the go. That said, deleting just the troubled object is enough in this case.

lpechacek avatar Mar 11 '22 12:03 lpechacek

I did a lot of random operations by adding and removing points, cutting holes in area objects, merging holes, deleting holes etc., but I was not able to get a similar error (which is obvious since it apparently never happened before).

Remo: did that error occur during editing your map, or did it happen after it was loaded?

dl3sdo avatar Mar 11 '22 13:03 dl3sdo

I did a lot of random operations by adding and removing points, cutting holes in area objects, merging holes, deleting holes etc., but I was not able to get a similar error (which is obvious since it apparently never happened before). eft Remo: did that error occur during editing your map, or did it happen after it was loaded?

I think the glitch came while drawing (most probably on windows PC but I cannot be sure - it could also be on android, but less likely) Then I think the problem stayed silent maybe for hours while I kept drawing in another area of the map. And then suddenly it came out - when I pressed shift to append a line to a contour and the notorious object was visible in the window

And thanks a lot for your answer on objects count etc etc - it's good to know something more of how things work 'behind the scenes'

rem-maps avatar Mar 11 '22 22:03 rem-maps