Skip to content

NRE on core reboot if memory callback is set via Lua with mGBA #4631

@CasualPokePlayer

Description

@CasualPokePlayer

Other cores don't appear to have any issue.

Basic script to reproduce the issue

event.on_bus_write(function() end, 0)
System.NullReferenceException: Object reference not set to an instance of an object.
   at BizHawk.Emulation.Cores.Nintendo.GBA.MGBAMemoryCallbackSystem.Remove(CallbackContainer cb) in /src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAMemoryCallbackSystem.cs:line 113
   at BizHawk.Emulation.Cores.Nintendo.GBA.MGBAMemoryCallbackSystem.Remove(MemoryCallbackDelegate action) in /src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAMemoryCallbackSystem.cs:line 144
   at BizHawk.Client.Common.LuaFunctionList.RemoveInner(NamedLuaFunction function) in /src/BizHawk.Client.Common/lua/LuaFunctionList.cs:line 40
   at BizHawk.Client.Common.LuaFunctionList.RemoveForFile(LuaFile file) in /src/BizHawk.Client.Common/lua/LuaFunctionList.cs:line 47
   at BizHawk.Client.EmuHawk.LuaConsole.DisableLuaScript(LuaFile file) in /src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs:line 1562
   at BizHawk.Client.EmuHawk.LuaConsole.Restart() in /src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs:line 221
   at BizHawk.Client.EmuHawk.ToolManager.Restart(Config config, IEmulator emulator, IGameInfo game) in /src/BizHawk.Client.EmuHawk/tools/ToolManager.cs:line 607
   at BizHawk.Client.EmuHawk.MainForm.LoadRomInternal(String path, LoadRomArgs args, Boolean& failureIsFromAskSave) in /src/BizHawk.Client.EmuHawk/MainForm.cs:line 3804
   at BizHawk.Client.EmuHawk.MainForm.LoadRom(String path, LoadRomArgs args, Boolean& failureIsFromAskSave) in /src/BizHawk.Client.EmuHawk/MainForm.cs:line 3575
   at BizHawk.Client.EmuHawk.MainForm.RebootCore() in /src/BizHawk.Client.EmuHawk/MainForm.cs:line 1338
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions