Skip to content

fix: clear[] crashed after a fire whose front had stopped - #194

Open
yanissrairi wants to merge 1 commit into
forefireAPI:devfrom
yanissrairi:fix/timetable-dangling-head
Open

yanissrairi wants to merge 1 commit into
forefireAPI:devfrom
yanissrairi:fix/timetable-dangling-head

Conversation

@yanissrairi

Copy link
Copy Markdown
Contributor

When a fire's front stops everywhere (e.g. an ignition in non-burnable fuel), the next clear[] segfaults.

getUpcomingEvent took the last event out but left head pointing at it. The stopped node's event has an infinite time, so insert() deleted it, and clear() deleted it again through head. The fix sets head = nullptr in that branch.

Reproduction, from tests/runff:

include[params.ff]
loadData[data.nc;2025-02-10T17:35:54Z]
startFire[loc=(38305.0,28205.0,0);t=0]
goTo[t=600]
clear[]
loadData[data.nc;2025-02-10T17:35:54Z]
startFire[loc=(35881.873264425,28699.674854985,0);t=0]
goTo[t=600]

Added tests/unit/test_timetable.cpp, which crashes without the fix. ctest and runff pass.

When the last event is taken out of the TimeTable, getUpcomingEvent left
head pointing at it. If that event then had an infinite time (its node
stopped), insert() deleted it and head dangled, so clear() deleted it a
second time. dropAtomEvents could likewise delete the event being processed.
@yanissrairi
yanissrairi force-pushed the fix/timetable-dangling-head branch from 545bbef to 1b011b7 Compare October 5, 2026 12:09
@filippi

filippi commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

thanks @yanissrairi the clear[] hasn't been much tested yet. My problem is testing it into a coupled fire/atmospher context with MPI and Fortan bindings, which i have no time to do yet.. very sorry. I'll be back on these around Oct 20.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants