Open jdevnull opened 1 month ago
Looks like the crashes were caused by the entrance
linked list not being cloned on hedit. This caused the actual host's entrances to be blown away when the edited host was extracted, which broke memory constraints.
Yeah, this was what I was trying to describe in part 3 of the PR description. That said, we don't actually need to clone the entrance list, since they're going to be rebuilt anyway - we just need the copy to not point to the actual host's linked list, so we can just assign it to null.
When host changes are saved, we call
collate_host_entrances
to rebuild entrance lists. Thus, when deleting host A, we don't need to search other hosts for entrances pointing to host A. This solves the issue of trying to find an entrance in another host that may not (yet) exist.It makes sense to clear host A's own list of entrances as part of
free_host
instead of inhedit
.When making a copy of an existing host for editing in
olc
, we don't want the copy to point to the existing host's list of entrances. This solves the issue where we can end up with a pointer directing us to freed memory. We also don't need to make a copy of the list becausecollate_host_entrances
will rebuild the list if/when we save, so we can just set it to null.