Fix ipc_manager::add
Thanks to @Farseer2 for debugging
This commit is contained in:
+8
-1
@@ -26,7 +26,9 @@ public:
|
|||||||
// Get object location
|
// Get object location
|
||||||
std::weak_ptr<T>& wptr = g_ipc.m_map[ipc_key];
|
std::weak_ptr<T>& wptr = g_ipc.m_map[ipc_key];
|
||||||
|
|
||||||
if ((out && !(*out = wptr.lock())) || wptr.expired())
|
std::shared_ptr<T> old;
|
||||||
|
|
||||||
|
if ((out && !(old = wptr.lock())) || wptr.expired())
|
||||||
{
|
{
|
||||||
// Call a function which must return the object
|
// Call a function which must return the object
|
||||||
if (out)
|
if (out)
|
||||||
@@ -42,6 +44,11 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (out)
|
||||||
|
{
|
||||||
|
*out = std::move(old);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user