MantisBT - VCMI
View Issue Details
0003154VCMIAI - Battlespublic2020-10-25 06:492022-03-27 18:30
normalminorhave not tried
0003154: Potential race condition locking a weak pointer
There is a potential race condition at lines 52 - 55 in client\battle\CBattleInterface.cpp.

    std::shared_ptr<CCreatureAnimation> animation = anim.lock();
    if (animation->isIdle())

Using a shared pointer obtained by locking a weak pointer without checking the result of the lock could result in a crash if the shared pointer has expired before lock() is called.

When expired() is called before lock() in a multi-threaded environment, it is possible for the shared pointer to expire between expired() and lock(). The safe method is to check the result of lock().
Issue History
2020-10-25 06:49jamboloNew Issue
2020-10-25 06:50jamboloNote Added: 0007946
2022-03-17 09:43PovelitelAssigned To => Nullkiller
2022-03-17 09:43PovelitelStatusnew => assigned
2022-03-22 19:35PovelitelTag Attached: R1
2022-03-27 18:30PovelitelStatusassigned => resolved
2022-03-27 18:30PovelitelFixed in Version =>
2022-03-27 18:30PovelitelResolutionopen => fixed

2020-10-25 06:50   
Sorry, category is incorrect.