mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2025-09-16 13:27:54 -05: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:
@@ -17,7 +17,7 @@ namespace Ryujinx.OsHle.Handles
|
||||
ObjIds = new IdPool();
|
||||
}
|
||||
|
||||
public int GenertateObjectId(object Obj)
|
||||
public int GenerateObjectId(object Obj)
|
||||
{
|
||||
int Id = ObjIds.GenerateId();
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user