Merge pull request #2072 from elsid/navmesh_tiles_cache_item_fix

Navmesh tiles cache item fix (bug #4751)
pull/541/head
Bret Curtis 6 years ago committed by GitHub
commit 401ccedb36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -56,12 +56,12 @@ namespace DetourNavigator
Value(Value&& other)
: mOwner(other.mOwner), mIterator(other.mIterator)
{
other.mIterator = ItemIterator();
other.mOwner = nullptr;
}
~Value()
{
if (mIterator != ItemIterator())
if (mOwner)
mOwner->releaseItem(mIterator);
}
@ -69,16 +69,13 @@ namespace DetourNavigator
Value& operator =(Value&& other)
{
if (mIterator == other.mIterator)
return *this;
if (mIterator != ItemIterator())
if (mOwner)
mOwner->releaseItem(mIterator);
mOwner = other.mOwner;
mIterator = other.mIterator;
other.mIterator = ItemIterator();
other.mOwner = nullptr;
return *this;
}
@ -90,7 +87,7 @@ namespace DetourNavigator
operator bool() const
{
return mIterator != ItemIterator();
return mOwner;
}
private:

Loading…
Cancel
Save