[BROWSEUI] CAutoComplete::OnAutoCompStart(): Wait on the thread only when there is a handle.

Avoids spamming
(ntoskrnl\ob\obwait.c:441) Failed to reference the handle with status 0xc0000008

CAutoComplete::FinishCompletion(): Remove two useless 'if (m_pThread || !m_hThread)'
tests: No need to check these after each code instruction...
This commit is contained in:
Hermès Bélusca-Maïto
2021-09-17 19:16:02 +02:00
parent ffc4febb0c
commit 5f8a10f32b

View File

@@ -2092,13 +2092,16 @@ LRESULT CAutoComplete::OnAutoCompStart(UINT uMsg, WPARAM wParam, LPARAM lParam,
delete pOld;
BOOL bDoStart = FALSE;
DWORD dwWait = WaitForSingleObject(m_hThread, 0);
if (dwWait != WAIT_TIMEOUT)
if (m_hThread)
{
CloseHandle(m_hThread);
bDoStart = TRUE;
if (WaitForSingleObject(m_hThread, 0) != WAIT_TIMEOUT)
{
CloseHandle(m_hThread);
m_hThread = NULL;
bDoStart = TRUE;
}
}
else if (!m_hThread)
else
{
bDoStart = TRUE;
}
@@ -2131,15 +2134,9 @@ VOID CAutoComplete::FinishCompletion(PAC_THREAD pThread)
if (!CanAutoSuggest() && !CanAutoAppend())
return;
if (m_pThread || !m_hThread)
return;
// set inner list
m_innerList = pThread->m_innerList;
if (m_pThread || !m_hThread)
return;
// set the items of the virtual listview
m_outerList = pThread->m_outerList; // FIXME: We need more speed!
m_hwndList.SendMessageW(LVM_SETITEMCOUNT, m_outerList.GetSize(), 0);