ryujinx-mirror/Ryujinx/OsHle/Handles/HSessionObj.cs
Stary 2001 2f2b60db4c 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
2018-02-10 15:31:40 -03:00

30 lines
No EOL
635 B
C#

using System;
namespace Ryujinx.OsHle.Handles
{
class HSessionObj : HSession, IDisposable
{
public object Obj { get; private set; }
public HSessionObj(HSession Session, object Obj) : base(Session)
{
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();
}
}
}
}
}