1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00

Fix clean unused navmeshes

weak_ptr doesn't have constructor for shared_ptr&& type, so ptr wasn't
moved, just copied.
This commit is contained in:
elsid 2019-03-17 21:24:49 +03:00
parent ab69ad65ed
commit 8adc83f6e2
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

View File

@ -22,7 +22,8 @@ namespace
template <class T>
bool resetIfUnique(std::shared_ptr<T>& ptr)
{
const std::weak_ptr<T> weak = std::move(ptr);
const std::weak_ptr<T> weak(ptr);
ptr.reset();
if (auto shared = weak.lock())
{
ptr = std::move(shared);