mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 18:09:40 +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:
parent
ab69ad65ed
commit
8adc83f6e2
1 changed files with 2 additions and 1 deletions
|
@ -22,7 +22,8 @@ namespace
|
||||||
template <class T>
|
template <class T>
|
||||||
bool resetIfUnique(std::shared_ptr<T>& ptr)
|
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())
|
if (auto shared = weak.lock())
|
||||||
{
|
{
|
||||||
ptr = std::move(shared);
|
ptr = std::move(shared);
|
||||||
|
|
Loading…
Reference in a new issue