mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
a16c4a9fe2
videoio(avfoundation): fix SIGSEGV crash when releasing VideoWriter on iOS #29359 Replace deprecated synchronous finishWriting with finishWritingWithCompletionHandler + dispatch_semaphore to properly wait for the async completion handler. The synchronous finishWriting method is deprecated since iOS 6 and, despite blocking until writing status completes, does NOT wait for internal NSOperation KVO observer blocks that are dispatched asynchronously to GCD worker threads. When the destructor returns and drains the autorelease pool, these blocks may access already-released objects, causing SIGSEGV. This fix uses a semaphore to block until the finishWritingWithCompletionHandler callback has fully completed, eliminating the race condition between the async block and autorelease pool drain. Fixes #28165