YUView
YUView copied to clipboard
fix: resolve crashes caused by using the ffmpeg library
- Addressed issue where repeated reloading of the ffmpeg library led to crashes. Previously, each component attempted to load the ffmpeg library and executed an unload before loading, causing other components to retain stale function addresses if the library was reloaded at a different address. This issue was particularly prevalent on macOS.
- Fixed undefined behavior due to incorrect size assumption of std::function objects. On certain platforms like arm64 macOS, sizeof(std::function<void()>) is 32, not the same as a pointer size. This discrepancy led to undefined behavior when forcibly casting.
This fix ensures that the library is loaded only once per process and corrects the handling of std::function objects to prevent crashes.