diff --git a/dlls/atl/atl_main.c b/dlls/atl/atl_main.c index 41b33ce3fd1..5ef083e9fe7 100644 --- a/dlls/atl/atl_main.c +++ b/dlls/atl/atl_main.c @@ -440,27 +440,32 @@ void WINAPI AtlModuleAddCreateWndData(_ATL_MODULEW *pM, _AtlCreateWndData *pData /*********************************************************************** * AtlModuleExtractCreateWndData [ATL.@] * - * NOTE: I failed to find any good description of this function. - * Tests show that this function extracts one of _AtlCreateWndData + * NOTE: Tests show that this function extracts one of _AtlCreateWndData * records from the current thread from a list * */ void* WINAPI AtlModuleExtractCreateWndData(_ATL_MODULEW *pM) { _AtlCreateWndData **ppData; + void *ret = NULL; TRACE("(%p)\n", pM); + EnterCriticalSection(&pM->m_csWindowCreate); + for(ppData = &pM->m_pCreateWndList; *ppData!=NULL; ppData = &(*ppData)->m_pNext) { if ((*ppData)->m_dwThreadID == GetCurrentThreadId()) { _AtlCreateWndData *pData = *ppData; *ppData = pData->m_pNext; - return pData->m_pThis; + ret = pData->m_pThis; + break; } } - return NULL; + + LeaveCriticalSection(&pM->m_csWindowCreate); + return ret; } /***********************************************************************