diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index d7127e899..08843989b 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -114,7 +114,10 @@ public: void PushMoveHandles(H... handles); template - void PushObjects(Kernel::SharedPtr... pointers); + void PushCopyObjects(Kernel::SharedPtr... pointers); + + template + void PushMoveObjects(Kernel::SharedPtr... pointers); void PushCurrentPIDHandle(); @@ -187,7 +190,12 @@ inline void RequestBuilder::PushMoveHandles(H... handles) { } template -inline void RequestBuilder::PushObjects(Kernel::SharedPtr... pointers) { +inline void RequestBuilder::PushCopyObjects(Kernel::SharedPtr... pointers) { + PushCopyHandles(context->AddOutgoingHandle(std::move(pointers))...); +} + +template +inline void RequestBuilder::PushMoveObjects(Kernel::SharedPtr... pointers) { PushMoveHandles(context->AddOutgoingHandle(std::move(pointers))...); } diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 855a63a5c..c53b62f4c 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -206,7 +206,7 @@ void File::OpenLinkFile(Kernel::HLERequestContext& ctx) { ClientConnected(std::get>(sessions)); rb.Push(RESULT_SUCCESS); - rb.PushObjects(std::get>(sessions)); + rb.PushMoveObjects(std::get>(sessions)); } File::~File() {} diff --git a/src/core/hle/service/sm/srv.cpp b/src/core/hle/service/sm/srv.cpp index d05cec5b3..b669aa8a9 100644 --- a/src/core/hle/service/sm/srv.cpp +++ b/src/core/hle/service/sm/srv.cpp @@ -66,7 +66,7 @@ void SRV::EnableNotification(Kernel::HLERequestContext& ctx) { IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); rb.Push(RESULT_SUCCESS); - rb.PushObjects(notification_semaphore); + rb.PushCopyObjects(notification_semaphore); LOG_WARNING(Service_SRV, "(STUBBED) called"); } @@ -114,7 +114,7 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) { (*session)->GetObjectId()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); rb.Push(session.Code()); - rb.PushObjects(std::move(session).Unwrap()); + rb.PushMoveObjects(std::move(session).Unwrap()); } else if (session.Code() == Kernel::ERR_MAX_CONNECTIONS_REACHED && wait_until_available) { LOG_WARNING(Service_SRV, "called service=%s -> ERR_MAX_CONNECTIONS_REACHED", name.c_str()); // TODO(Subv): Put the caller guest thread to sleep until this port becomes available again. @@ -204,7 +204,7 @@ void SRV::RegisterService(Kernel::HLERequestContext& ctx) { IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); rb.Push(RESULT_SUCCESS); - rb.PushObjects(port.Unwrap()); + rb.PushMoveObjects(port.Unwrap()); } SRV::SRV(std::shared_ptr service_manager)