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

Check for revision inequality

It's not possible to have SafePtr with mLastUpdate from the future. But
theoretically it's possible to get PtrRegistry::mRevision overflow so operator
less would return false when there is a change.
This commit is contained in:
elsid 2023-05-28 12:35:38 +02:00
parent ce91784085
commit a581e394b4
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625

View file

@ -40,7 +40,7 @@ namespace MWWorld
void SafePtr::update() const void SafePtr::update() const
{ {
const PtrRegistry& registry = MWBase::Environment::get().getWorldModel()->getPtrRegistry(); const PtrRegistry& registry = MWBase::Environment::get().getWorldModel()->getPtrRegistry();
if (mLastUpdate < registry.getRevision()) if (mLastUpdate != registry.getRevision())
{ {
mPtr = registry.getOrDefault(mId); mPtr = registry.getOrDefault(mId);
mLastUpdate = registry.getRevision(); mLastUpdate = registry.getRevision();