Skip to content

fix: delay VideoPlayerController disposal to avoid crash on HQ switch#28

Open
Syed-Moiz-Ali wants to merge 1 commit into
windoze95:mainfrom
Syed-Moiz-Ali:fix/video-player-disposal
Open

fix: delay VideoPlayerController disposal to avoid crash on HQ switch#28
Syed-Moiz-Ali wants to merge 1 commit into
windoze95:mainfrom
Syed-Moiz-Ali:fix/video-player-disposal

Conversation

@Syed-Moiz-Ali

Copy link
Copy Markdown

Description\n\nWraps the old controller's pause/dispose in \Future.microtask()\ to ensure disposal happens after the current frame's widget tree has fully unmounted the old VideoPlayer widget.\n\n## Fixes\n\nFixes #19 — Crash on Synchronous VideoPlayerController Disposal\n\n## Root Cause\n\n_switchToHq()\ was synchronously calling \oldController?.pause()\ and \oldController?.dispose()\ right after \setState(). Since the widget tree hadn't finished unmounting the old \VideoPlayer\ widget in the same frame, attached listeners (\ValueListenableBuilder) could still trigger updates on the disposed controller, causing an assertion error.

@Syed-Moiz-Ali Syed-Moiz-Ali force-pushed the fix/video-player-disposal branch from e17f5d8 to c96a2cb Compare June 16, 2026 08:04
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