mirror of
https://github.com/opencv/opencv.git
synced 2026-07-28 23:03:03 +04:00
fbd550438f
catch _com_error exceptions to suppress debugger flooding #28073 Resolves: #27643 This PR fixes an issue where the Microsoft Media Foundation (MSMF) backend triggers repeated C++ exceptions (_com_error) during video capture. While these exceptions are often non-fatal "first-chance" exceptions, they cause the Visual Studio debugger to break execution repeatedly, making debugging difficulty and flooding the output window. Changes cap_msmf.cpp: Added try-catch blocks around critical COM interaction paths. Updated SourceReaderCB::OnReadSample (Async callback) to catch _com_error. Updated CvCapture_MSMF::grabFrame (Synchronous grab) to catch _com_error. Added CV_LOG_WARNING to log the error message from the caught exception, ensuring that actual errors are still visible in the logs without crashing the application or halting the debugger. Impact Users debugging OpenCV applications on Windows with Visual Studio will no longer be interrupted by internal MSMF exceptions when using the default backend. The application flow remains uninterrupted even if MSMF encounters transient internal errors.