MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003154VCMIAI - Battlespublic2020-10-25 06:492020-10-25 06:50
Reporterjambolo 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0003154: Potential race condition locking a weak pointer
DescriptionThere is a potential race condition at lines 52 - 55 in client\battle\CBattleInterface.cpp.
<code>
    if(anim.expired())
        return;

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

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().
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0007946)
jambolo (reporter)
2020-10-25 06:50

Sorry, category is incorrect.

- Issue History
Date Modified Username Field Change
2020-10-25 06:49 jambolo New Issue
2020-10-25 06:50 jambolo Note Added: 0007946

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2020 MantisBT Team
Hosting provided by DigitalOcean