unsubscribe from events in core Dispose methods
- closes #4157 Not sure this is the best way to fix the linked issue, but considering this is a hard crash I'd rather fix it somehow than not at all for now.
This commit is contained in:
parent
b8baf21788
commit
b93a995083
|
@ -41,6 +41,7 @@ namespace BizHawk.Emulation.Cores.Calculators.Emu83
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
_memoryCallbacks.ActiveChanged -= SetMemoryCallbacks;
|
||||
if (Context != IntPtr.Zero)
|
||||
{
|
||||
LibEmu83.TI83_DestroyContext(Context);
|
||||
|
|
|
@ -300,5 +300,11 @@ namespace BizHawk.Emulation.Cores.Atari.Jaguar
|
|||
Marshal.Copy(_buf2352, 0, dst, 2352);
|
||||
DriveLightOn = true;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
_memoryCallbacks.ActiveChanged -= SetMemoryCallbacks;
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,6 +163,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
_memorycallbacks.ActiveChanged -= SetMemoryCallbacks;
|
||||
if (GambatteState != IntPtr.Zero)
|
||||
{
|
||||
LibGambatte.gambatte_destroy(GambatteState);
|
||||
|
|
|
@ -539,6 +539,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
_glContext = null;
|
||||
}
|
||||
|
||||
_memoryCallbacks.ActiveChanged -= SetMemoryCallbacks;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
|
|
|
@ -156,6 +156,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Sameboy
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
_memorycallbacks.ActiveChanged -= SetMemoryCallbacks;
|
||||
if (SameboyState != IntPtr.Zero)
|
||||
{
|
||||
LibSameboy.sameboy_destroy(SameboyState);
|
||||
|
|
|
@ -122,6 +122,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
_memoryCallbacks.ActiveChanged -= RefreshMemCallbacks;
|
||||
_elf?.Dispose();
|
||||
|
||||
if (_cds != null)
|
||||
|
|
|
@ -348,6 +348,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
|
||||
disposed = true;
|
||||
|
||||
_memoryCallbacks.ActiveChanged -= RefreshMemCallbacks;
|
||||
|
||||
//discs arent bound to shock core instances, but they may be mounted. kill the core instance first to effectively dereference the disc
|
||||
OctoshockDll.shock_Destroy(psx);
|
||||
psx = IntPtr.Zero;
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
_inputCallbacks.ActiveChanged -= SetInputCallback;
|
||||
_memorycallbacks.ActiveChanged -= SetMemoryCallbacks;
|
||||
if (Core != IntPtr.Zero)
|
||||
{
|
||||
BizSwan.bizswan_delete(Core);
|
||||
|
|
Loading…
Reference in New Issue