remove CoUninitialize calls for FIX_BUGS (fixes PIX crash) and don't check return value for CoInitialize

This commit is contained in:
withmorten 2020-08-07 18:21:05 +02:00
parent 504d004025
commit ce0633a0c2

View file

@ -1851,7 +1851,11 @@ void PlayMovieInWindow(int cmdShow, const char* szFile)
MultiByteToWideChar(CP_ACP, 0, szFile, -1, wFileName, sizeof(wFileName) - 1); MultiByteToWideChar(CP_ACP, 0, szFile, -1, wFileName, sizeof(wFileName) - 1);
// Initialize COM // Initialize COM
#ifdef FIX_BUGS // will also return S_FALSE if it has already been inited in the same thread
CoInitialize(nil);
#else
JIF(CoInitialize(nil)); JIF(CoInitialize(nil));
#endif
// Get the interface for DirectShow's GraphBuilder // Get the interface for DirectShow's GraphBuilder
JIF(CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC, JIF(CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC,
@ -2225,7 +2229,9 @@ WinMain(HINSTANCE instance,
{ {
CloseClip(); CloseClip();
CoUninitialize(); #ifndef FIX_BUGS
CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter
#endif
if ( CMenuManager::OS_Language == LANG_FRENCH || CMenuManager::OS_Language == LANG_GERMAN ) if ( CMenuManager::OS_Language == LANG_FRENCH || CMenuManager::OS_Language == LANG_GERMAN )
PlayMovieInWindow(cmdShow, "movies\\GTAtitlesGER.mpg"); PlayMovieInWindow(cmdShow, "movies\\GTAtitlesGER.mpg");
@ -2260,7 +2266,9 @@ WinMain(HINSTANCE instance,
case GS_INIT_ONCE: case GS_INIT_ONCE:
{ {
CloseClip(); CloseClip();
CoUninitialize(); #ifndef FIX_BUGS
CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter
#endif
#ifdef FIX_BUGS #ifdef FIX_BUGS
// draw one frame because otherwise we'll end up looking at black screen for a while if vsync is on // draw one frame because otherwise we'll end up looking at black screen for a while if vsync is on