[BROWSEUI] Don't forget to CoInitializeEx on COM thread (#5552)

Use CoInitializeEx and CoUninitialize in
CFindFolder::SearchThreadProc.
CORE-19110
This commit is contained in:
Katayama Hirofumi MZ 2023-08-10 22:16:30 +09:00 committed by GitHub
parent b9958c7be7
commit 0aa2e82c06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -455,6 +455,8 @@ DWORD WINAPI CFindFolder::SearchThreadProc(LPVOID lpParameter)
{ {
_SearchData *data = static_cast<_SearchData*>(lpParameter); _SearchData *data = static_cast<_SearchData*>(lpParameter);
HRESULT hrCoInit = CoInitializeEx(NULL, COINIT_MULTITHREADED);
data->pFindFolder->NotifyConnections(DISPID_SEARCHSTART); data->pFindFolder->NotifyConnections(DISPID_SEARCHSTART);
UINT uTotalFound = RecursiveFind(data->szPath, data); UINT uTotalFound = RecursiveFind(data->szPath, data);
@ -469,6 +471,9 @@ DWORD WINAPI CFindFolder::SearchThreadProc(LPVOID lpParameter)
CloseHandle(data->hStopEvent); CloseHandle(data->hStopEvent);
delete data; delete data;
if (SUCCEEDED(hrCoInit))
CoUninitialize();
return 0; return 0;
} }