AcademySoftwareFoundation / OpenRV

Open source version of RV, the Sci-Tech award-winning media review and playback software.
Other
577 stars 142 forks source link

Fix Windows crash on exit with upcoming NDI video output plugin #510

Closed bernie-laberge closed 2 months ago

bernie-laberge commented 2 months ago

Fix Windows crash on exit with upcoming NDI video output plugin

Linked issues

NA

Summarize your change.

This commit makes sure that the allocated video modules are released when RV exits. To do so, the TwkApp::VideoModules container which previously contained raw pointers (std::vector<VideoModule*>) which were never released on exit, has been converted to std::vector<std::shared_ptr>

Describe the reason for the change.

This missing TwkApp::VideoModules cleanup on exit, was causing a crash on Windows when the upcoming NDI video output plugin was unloaded. More specifically: The NDI crash was caused when trying to unload the NDI dll without having called the NDIlib_destroy(). Note that NDIlib_initialize() is called when allocating an NDI video module while the NDIlib_destroy() is called when releasing the NDI video module. So it became essential to fix this TwkApp::VideoModules cleanup on exit to prevent a crash on Windows.

Describe what you have tested and on which operating system.

Successfully tested on macOS and Windows.

Add a list of changes, and note any that might need special attention during the review.

If possible, provide screenshots.