mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-10 16:52:16 +00:00
Fix use-after-frees around mobjs
# Conflicts: # src/p_enemy.c # src/p_mobj.c # src/p_saveg.c # src/p_tick.c
This commit is contained in:
parent
902fcfa569
commit
6dfd49a3b9
3 changed files with 6 additions and 5 deletions
|
|
@ -6701,7 +6701,7 @@ static void K_MoveHeldObjects(player_t *player)
|
|||
targz += (player->mo->height/2 - 32*player->mo->scale)*6;
|
||||
}
|
||||
|
||||
if (cur->tracer)
|
||||
if (cur->tracer && !P_MobjWasRemoved(cur->tracer))
|
||||
{
|
||||
fixed_t diffx, diffy, diffz;
|
||||
|
||||
|
|
|
|||
|
|
@ -10345,7 +10345,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
mobj_t *side = P_SpawnMobj(mobj->x + FINECOSINE((ang>>ANGLETOFINESHIFT) & FINEMASK),
|
||||
mobj->y + FINESINE((ang>>ANGLETOFINESHIFT) & FINEMASK), mobj->z, MT_DAYTONAPINETREE_SIDE);
|
||||
P_InitAngle(side, ang);
|
||||
side->target = mobj;
|
||||
P_SetTarget(&side->target, mobj);
|
||||
side->threshold = i;
|
||||
}
|
||||
break;
|
||||
|
|
@ -10762,6 +10762,7 @@ void P_RemoveSavegameMobj(mobj_t *mobj)
|
|||
|
||||
// free block
|
||||
P_RemoveThinker((thinker_t *)mobj);
|
||||
R_RemoveMobjInterpolator(mobj);
|
||||
}
|
||||
|
||||
static CV_PossibleValue_t respawnitemtime_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}};
|
||||
|
|
|
|||
|
|
@ -4193,21 +4193,21 @@ static void P_RelinkPointers(void)
|
|||
{
|
||||
temp = (UINT32)(size_t)mobj->hnext;
|
||||
mobj->hnext = NULL;
|
||||
if (!(mobj->hnext = P_FindNewPosition(temp)))
|
||||
if (!P_SetTarget(&mobj->hnext, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "hnext not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->hprev)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->hprev;
|
||||
mobj->hprev = NULL;
|
||||
if (!(mobj->hprev = P_FindNewPosition(temp)))
|
||||
if (!P_SetTarget(&mobj->hprev, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "hprev not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->itnext)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->itnext;
|
||||
mobj->itnext = NULL;
|
||||
if (!(mobj->itnext = P_FindNewPosition(temp)))
|
||||
if (!P_SetTarget(&mobj->itnext, P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "itnext not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->terrain)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue