Make HSessionObj implement IDisposable, so that objects that have handles created to them are disposed when the handles are closed.

This commit is contained in:
Ezekiel Bethel 2018-02-10 18:18:52 +00:00
parent 55743c0cba
commit b0c8a92ea4

View file

@ -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();
}
}
}
}
}