Fix clean unused navmeshes

weak_ptr doesn't have constructor for shared_ptr&& type, so ptr wasn't
moved, just copied.
pull/541/head
elsid 6 years ago
parent ab69ad65ed
commit 8adc83f6e2
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -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);

Loading…
Cancel
Save