0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-23 14:45:45 +00:00

Close ILibraryAppletAccessor handles on disposal (#2094)

This commit is contained in:
gdkchan 2021-03-10 17:36:38 -03:00 committed by GitHub
parent dbce3455ad
commit 5ab5b0e709
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,14 +1,17 @@
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Applets; using Ryujinx.HLE.HOS.Applets;
using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading; using Ryujinx.HLE.HOS.Kernel.Threading;
using System; using System;
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.LibraryAppletCreator namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.LibraryAppletCreator
{ {
class ILibraryAppletAccessor : IpcService class ILibraryAppletAccessor : IpcService, IDisposable
{ {
private KernelContext _kernelContext;
private IApplet _applet; private IApplet _applet;
private AppletSession _normalSession; private AppletSession _normalSession;
@ -24,6 +27,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Lib
public ILibraryAppletAccessor(AppletId appletId, Horizon system) public ILibraryAppletAccessor(AppletId appletId, Horizon system)
{ {
_kernelContext = system.KernelContext;
_stateChangedEvent = new KEvent(system.KernelContext); _stateChangedEvent = new KEvent(system.KernelContext);
_normalOutDataEvent = new KEvent(system.KernelContext); _normalOutDataEvent = new KEvent(system.KernelContext);
_interactiveOutDataEvent = new KEvent(system.KernelContext); _interactiveOutDataEvent = new KEvent(system.KernelContext);
@ -223,5 +228,23 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Lib
return ResultCode.Success; return ResultCode.Success;
} }
public void Dispose()
{
if (_stateChangedEventHandle != 0)
{
_kernelContext.Syscall.CloseHandle(_stateChangedEventHandle);
}
if (_normalOutDataEventHandle != 0)
{
_kernelContext.Syscall.CloseHandle(_normalOutDataEventHandle);
}
if (_interactiveOutDataEventHandle != 0)
{
_kernelContext.Syscall.CloseHandle(_interactiveOutDataEventHandle);
}
}
} }
} }