Linux debug: hot restart no longer crashes with live mpv players

Hot restart frees the old isolate's NativeCallables while mpv handles stay
alive; media_kit then quits them on the next start and mpv calls the dead
wakeup callback (SIGSEGV on the mpv 'core' thread). A debug-only runner
hook clears every live handle's wakeup callback on the engine's
on-pre-engine-restart signal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
foxyzandClaude Opus 5.5 committed 2026-10-09 18:53:07 +03:00
1 parent 151ec95289
commit d002ff6941
5 files changed
+100 -1

No files matched your search

@@ -0,0 +1,13 @@
#ifndef RUNNER_HOT_RESTART_GUARD_H_
#define RUNNER_HOT_RESTART_GUARD_H_
#include <flutter_linux/flutter_linux.h>
// Debug builds: before a hot restart tears the Dart isolate down, unhooks
// the libmpv wakeup callbacks that media_kit's players point at that
// isolate's NativeCallables. Without this, the next mpv event on a leftover
// player calls into freed code and the process dies (SIGSEGV on mpv's
// "core" thread). No-op in profile/release.
void hot_restart_guard_attach(FlView* view);
#endif // RUNNER_HOT_RESTART_GUARD_H_