Fix a crash when closing the main UI (#904)

* Fix a crash when closing the main Ui

Also make sure to dispose the OpenAL context to not leak memory when
unloading the emulation context.

* Improve keys and 'game already running' dialogs

* Make sure to dispose the page table and ThreadContext

Less memory leaks!

* Fix tests

* Address gdk's comments
This commit is contained in:
Thog 2020-02-06 12:38:24 +01:00 committed by GitHub
parent f2b9a9c2b0
commit a906f2071c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 10 deletions

View file

@ -107,6 +107,7 @@ namespace Ryujinx.HLE.HOS
public Keyset KeySet => Device.FileSystem.KeySet;
private bool _hasStarted;
private bool _isDisposed;
public BlitStruct<ApplicationControlProperty> ControlData { get; set; }
@ -740,8 +741,10 @@ namespace Ryujinx.HLE.HOS
protected virtual void Dispose(bool disposing)
{
if (disposing)
if (!_isDisposed && disposing)
{
_isDisposed = true;
KProcess terminationProcess = new KProcess(this);
KThread terminationThread = new KThread(this);

View file

@ -1131,5 +1131,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
{
throw new UndefinedInstructionException(e.Address, e.OpCode);
}
protected override void Destroy()
{
CpuMemory.Dispose();
}
}
}

View file

@ -1141,6 +1141,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
{
Owner.Translator.Execute(Context, entrypoint);
Context.Dispose();
ThreadExit();
}