Closed cldellow closed 5 months ago
I see that https://github.com/systemed/tilemaker/commit/c63040069824065a20f236524a0d53fbe9fccb27 failed with a segfault, looks like it was during node reading: https://github.com/systemed/tilemaker/actions/runs/7857409309/job/21441273093
It's possible that was this bug.
Thanks!
For now, I'm inclined to let a sleeping dog lie
🐶💤
Fixes the issued identified by @freeExec in #661
This code is a bit gross. It intentionally loops 1 past the size of the vector to ensure that we "publish" all the chunks.
There's a similar loop at lines 511-602.
In both loops, there's sort of three chunks of code, which I'll call "pre", "body" and "post". The pre/post sections need to be guarded, and the guard for the first loop's "post" section was missing.
Looking at it with fresh eyes, I think we could extract the "body" parts of both loops to their own functions, change the loop to use
<
instead of<=
and then just call the body function again after the loop ends if it's needed. For now, I'm inclined to let a sleeping dog lie, but if more work happens in here, that'd be a good cleanup step.This was also visible in valgrind, as it turns out--the error goes away with this change:
SortedWayStore has a similar publishGroup function, but its internal implementation is different and it doesn't have this issue.