mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-08-02 10:37:09 +02:00
Make HSessionObj implement IDisposable (#10)
* Make HSessionObj implement IDisposable, so that objects that have handles created to them are disposed when the handles are closed. * Spelling fix: GenertateObjectId -> GenerateObjectId
This commit is contained in:
parent
55743c0cba
commit
2f2b60db4c
4 changed files with 22 additions and 4 deletions
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.OsHle.Handles
|
||||
{
|
||||
class HSessionObj : HSession
|
||||
class HSessionObj : HSession, IDisposable
|
||||
{
|
||||
public object Obj { get; private set; }
|
||||
|
||||
|
@ -8,5 +10,21 @@ namespace Ryujinx.OsHle.Handles
|
|||
{
|
||||
this.Obj = Obj;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool Disposing)
|
||||
{
|
||||
if(Disposing && Obj != null)
|
||||
{
|
||||
if(Obj is IDisposable DisposableObj)
|
||||
{
|
||||
DisposableObj.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue