1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:23:53 +00:00

Assign the return value of weak_ptr::lock() to a variable, so that the

shared object lifetime is properly extended. Otherwise there is a
possibility that the Actor gets destroyed during call to unstuck().
This commit is contained in:
fredzio 2021-07-11 18:01:20 +02:00
parent 83af0402b8
commit 1650dabed8

View file

@ -599,7 +599,7 @@ namespace MWPhysics
if (!mRemainingSteps)
return;
for (auto& data : mActorsFrameData)
if (data.mActor.lock())
if (const auto actor = data.mActor.lock())
{
std::unique_lock lock(mCollisionWorldMutex);
MovementSolver::unstuck(data, mCollisionWorld);