[mkgmap-dev] [PATCH v1] Tag delete bug fix
From Mark Burton markb at ordern.com on Thu Jan 7 19:24:48 GMT 2010
Hi Steve, I think I have found the problem in Tags.java that was causing the assertion when I tried to delete multiple tags. I believe the root cause was the fact that remove() would decrement size so it looked as if there was space but it didn't actually remove the key (as the comment there suggests that is not the place to do that). So later, when trying to add another tag, it looked as if there was space (because size had been decremented) but keyPos() returned null because all the slots in the key array were full. The attached patch fixes this issue by not decrementing size when a tag is deleted (the key will get "garbage collected" in ensureSpace() so that it will be removed when the arrays are grown) and size gets adjusted (see below). I also set size to 0 in ensureSpace() before copying the key/value pairs into the new arrays because put() will increment size when there isn't an existing value for that key (which there won't be when the arrays are being grown because they are newly allocated). Previously, when ensureSpace() copied the key/values into the new arrays size would have been incremented from its current value so that the arrays would look like they are almost full again straight away which means that they would be doubled in size for every couple of tags added (can that really be true?) Anyway, please check the attached patch for sanity as I don't profess to understand the tag stuff that well. Cheers, Mark -------------- next part -------------- A non-text attachment was scrubbed... Name: mb-tag-delete-fix-v1.patch Type: text/x-patch Size: 1157 bytes Desc: not available Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20100107/5f0db413/attachment.bin
- Previous message: [mkgmap-dev] Assertion when removing name/ref from way
- Next message: [mkgmap-dev] [PATCH v1] Tag delete bug fix
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list