TASEmulators / TASEmulators/BizHawk

Crash when rebooting emulator core

Open
#4,629 7 comments 0 reactions 0 assignees View on GitHub

@YoshiRulz is already working on this.

Since Feb 24, 2026.

  • #4638 by @YoshiRulz — open
re: Lua API/scripting Repro: Affects 2.11 Repro: Affects 2.3/2.3.1/2.3.2 Repro: Affects 2.7 Repro: Fixed/added in branch/fork
Dominant language
C#
Stars
2.8k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

The following Lua script crashes EmuHawk when rebooting the core:

event.onexit(function()
	memory.read_u8(0)
end)

while true do
	emu.frameadvance()
end

This happens because the script is not stopped until LuaConsole.Restart, at which point the old core instance has been disposed. (Of course, even if the exit handler read from the new core, that would not be correct either.)

Repro
  1. Open a ROM with a core that supports memory API
  2. Start the above Lua script
  3. Reload the ROM
Output

No error message.

Host env.

BizHawk 2.11 and current master

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the LuaConsole.Restart path and the event.onexit and memory API behavior described in the report. Review pull request #4638 for the work already underway, then reproduce the script while reloading the ROM. Done means the emulator does not crash and reports the failure appropriately when the exit handler accesses the disposed core.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, lua
Domain
desktop, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.