Repository navigation
fix(avplayer): close safely from event callbacks - #5944
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
jotitadev
left a comment
There was a problem hiding this comment.
Linux run (Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, non-GPU tests), head 5474b7756 merged onto main 44df21632.
- Builds;
guest_avplayerand the newguest_avplayer_callback_closepass. - With
AvPlayer.hpp/Player.cppfrommain:guest_avplayer_callback_closeaborts withstd::system_error/Resource deadlock avoided(glibc's EDEADLK for the self-join), the Linux counterpart of the Windows failure in the description.guest_avplayerstill passes.
Non-GPU suite (ctest -E "^agc"): same result as main; only file_writer_binary and file_writer_text fail, and they fail on main too on this machine (Ubuntu 26.04 coreutils).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
Checked on Linux: build and ctest of AvPlayer/libs (34 tests) pass; with |
What
Closing an AvPlayer from its event callback tried to join the controller thread that was running that callback.
std::thread::jointhrows for a self-join, terminating the process during destruction.When the controller closes its own player, detach that thread and retain a closure marker independently of the player. After the callback returns, the loop reads that marker and exits before accessing the destroyed player's locks or event queue. Closure from another thread still joins the controller normally.
The regression closes from the ready callback and the end-of-playback stop callback, creates a replacement player inside each callback, and checks that media allocations are released. It reuses the existing generated movie fixture and runs separately from the playback suite.
Tested
Windows 11 Pro 10.0.26300, supported WinLibs GCC 15.2.0, Release, main
e34c47921.std::system_errorfrom self-joining in the player destructor. With the fix it passes three consecutive runs (2.44 s total); the final test dispatcher layout also passes (0.88 s).guest_avplayerplayback suite passes (4.16 s). Full default Windows build, conventions and whitespace checks pass.Checklist
main; no other open PR implements the same functionsFull platform runtime CI requires a write-access collaborator to dispatch it under repository policy.