Skip to content

Commit 8ce5e0a

Browse files
authored
fix: fix flutter338 crash (#1320)
1 parent d310049 commit 8ce5e0a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎media_kit/lib/src/player/native/core/initializer_native_callable.dart‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ class InitializerNativeCallable {
6060
void dispose(Pointer<generated.mpv_handle> ctx) {
6161
_locks.remove(ctx.address);
6262
_eventCallbacks.remove(ctx.address);
63+
64+
// Clear the wakeup callback in libmpv before closing NativeCallable
65+
// to prevent libmpv from invoking a deleted callback
66+
mpv.mpv_set_wakeup_callback(ctx, nullptr, nullptr);
67+
6368
_wakeUpNativeCallables.remove(ctx.address)?.close();
6469
}
6570

0 commit comments

Comments
 (0)