From da3f3fd1fb1682d2b4f7c30600b6174942b71813 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 29 Aug 2017 21:23:54 +0300 Subject: [PATCH] Fix ipc_manager::add Thanks to @Farseer2 for debugging --- rpcs3/Emu/IPC.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/IPC.h b/rpcs3/Emu/IPC.h index d57deea9c6..aeca865b2f 100644 --- a/rpcs3/Emu/IPC.h +++ b/rpcs3/Emu/IPC.h @@ -26,7 +26,9 @@ public: // Get object location std::weak_ptr& wptr = g_ipc.m_map[ipc_key]; - if ((out && !(*out = wptr.lock())) || wptr.expired()) + std::shared_ptr 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; }