From fadcee14f8fca1b76b4ea48b1cfd136ccae8d182 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 28 Sep 2021 23:42:50 -0400 Subject: service: Replace service event creation with ServiceContext::CreateEvent The service context helps to manage all created events and allows us to close them upon destruction. --- src/core/hle/service/audio/audin_u.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/core/hle/service/audio/audin_u.cpp') diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp index 570525019..840d1d883 100644 --- a/src/core/hle/service/audio/audin_u.cpp +++ b/src/core/hle/service/audio/audin_u.cpp @@ -12,7 +12,7 @@ namespace Service::Audio { IAudioIn::IAudioIn(Core::System& system_) - : ServiceFramework{system_, "IAudioIn"}, buffer_event{system_.Kernel()} { + : ServiceFramework{system_, "IAudioIn"}, service_context{system_, "IAudioIn"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetAudioInState"}, @@ -35,11 +35,12 @@ IAudioIn::IAudioIn(Core::System& system_) RegisterHandlers(functions); - Kernel::KAutoObject::Create(std::addressof(buffer_event)); - buffer_event.Initialize("IAudioIn:BufferEvent"); + buffer_event = service_context.CreateEvent("IAudioIn:BufferEvent"); } -IAudioIn::~IAudioIn() = default; +IAudioIn::~IAudioIn() { + service_context.CloseEvent(buffer_event); +} void IAudioIn::Start(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_Audio, "(STUBBED) called"); @@ -53,7 +54,7 @@ void IAudioIn::RegisterBufferEvent(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(buffer_event.GetReadableEvent()); + rb.PushCopyObjects(buffer_event->GetReadableEvent()); } void IAudioIn::AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx) { -- cgit v1.2.3