Fix ipc_manager::add

Thanks to @Farseer2 for debugging
This commit is contained in:
Nekotekina 2017-08-29 21:23:54 +03:00
parent 26e13b4f5f
commit da3f3fd1fb
1 changed files with 8 additions and 1 deletions

View File

@ -26,7 +26,9 @@ public:
// Get object location
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
if (out)
@ -42,6 +44,11 @@ public:
return true;
}
if (out)
{
*out = std::move(old);
}
return false;
}