Skip to content

Fix access violation when closing server dialog - #28

Merged
Jay-Day merged 1 commit into
masterfrom
exception-fix
Feb 13, 2026
Merged

Jay-Day merged 1 commit into
masterfrom
exception-fix

Conversation

@Jay-Day

@Jay-Day Jay-Day commented Feb 13, 2026

Copy link
Copy Markdown
Owner

The GUI thread was deleting KAILLERAC.connection while the emulator thread was still using it inside kaillera_step(). The KAILLERA_CORE_INITIALIZED guard was set to false after cleanup instead of before, so the emulator thread could race past the check.

  • Set KAILLERA_CORE_INITIALIZED = false before disconnect/cleanup
  • Null the connection pointer before deleting the object
  • Add kaillera_step_active volatile flag so cleanup spin-waits for any in-flight kaillera_step() to finish (check_sockets blocks up to 200ms)
  • Add null checks inside kaillera_step() loop body

The GUI thread was deleting KAILLERAC.connection while the emulator
thread was still using it inside kaillera_step(). The
KAILLERA_CORE_INITIALIZED guard was set to false after cleanup instead
of before, so the emulator thread could race past the check.

- Set KAILLERA_CORE_INITIALIZED = false before disconnect/cleanup
- Null the connection pointer before deleting the object
- Add kaillera_step_active volatile flag so cleanup spin-waits for
  any in-flight kaillera_step() to finish (check_sockets blocks up
  to 200ms)
- Add null checks inside kaillera_step() loop body

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Jay-Day
Jay-Day merged commit d1d60cf into master Feb 13, 2026
2 checks passed
@Jay-Day
Jay-Day deleted the exception-fix branch February 16, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant