ephysics - fix real access-after-free issue on delete of constraint

this fixes CID 1039895
This commit is contained in:
Carsten Haitzler 2013-12-11 19:38:46 +09:00
parent 1c267deb8f
commit 4d7edf623b
1 changed files with 4 additions and 2 deletions

View File

@ -403,10 +403,12 @@ ephysics_constraint_del(EPhysics_Constraint *constraint)
return;
}
ephysics_world_lock_take(constraint->world);
// technically at this point locking and unlocking is pointless because
// if another thread is accessing this constraint, after this point it
// will be broken locks or not. this removes a segv in locking something
// we freed in _ephysics_constraint_del() by not locking.
_ephysics_constraint_del(constraint);
INF("Constraint deleted.");
ephysics_world_lock_release(constraint->world);
}