Fix use-after-frees around mobjs
Fixes a series of use-after-frees related to mobjs. Most notably, makes R_RemoveMobjInterpolator
properly remove the last item of interpolated_mobjs
, and fixes every place where target
, tracer
, hnext
or hprev
were modified without proper reference counting – including one in p_saveg.c.
A notable use-after-free that this fixes is one that happens when a player spectates. While I cannot test this myself, I have heard that spectating mid-race can cause desyncs – this has a good chance of fixing them.
Edited by X.organic