[BROWSEUI] Fix and small improvement (#3486)

Fix a mistake in CAutoComplete PR #3472 (6bfb76b) and improve.
- Fix confusion between m_hwndEdit and hwndEdit.
- Delete extra this-> codes.
CORE-9281
This commit is contained in:
Katayama Hirofumi MZ 2021-02-25 20:36:20 +09:00 committed by GitHub
parent c14c9ca0d8
commit f04890c2af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,14 +134,14 @@ HRESULT WINAPI CAutoComplete::Init(HWND hwndEdit, IUnknown *punkACL, LPCOLESTR p
if (m_options & ACO_RTLREADING) if (m_options & ACO_RTLREADING)
FIXME(" ACO_RTLREADING not supported\n"); FIXME(" ACO_RTLREADING not supported\n");
if (!m_hwndEdit || !punkACL) if (!hwndEdit || !punkACL)
return E_INVALIDARG; return E_INVALIDARG;
if (this->m_initialized) if (m_initialized)
{ {
WARN("Autocompletion object is already initialized\n"); WARN("Autocompletion object is already initialized\n");
/* This->hwndEdit is set to NULL when the edit window is destroyed. */ /* This->hwndEdit is set to NULL when the edit window is destroyed. */
return this->m_hwndEdit ? E_FAIL : E_UNEXPECTED; return m_hwndEdit ? E_FAIL : E_UNEXPECTED;
} }
if (!SUCCEEDED(punkACL->QueryInterface(IID_PPV_ARG(IEnumString, &m_enumstr)))) if (!SUCCEEDED(punkACL->QueryInterface(IID_PPV_ARG(IEnumString, &m_enumstr))))
@ -150,11 +150,11 @@ HRESULT WINAPI CAutoComplete::Init(HWND hwndEdit, IUnknown *punkACL, LPCOLESTR p
return E_NOINTERFACE; return E_NOINTERFACE;
} }
this->m_hwndEdit = hwndEdit; m_hwndEdit = hwndEdit;
this->m_initialized = TRUE; m_initialized = TRUE;
/* Keep at least one reference to the object until the edit window is destroyed. */ /* Keep at least one reference to the object until the edit window is destroyed. */
this->AddRef(); AddRef();
/* If another AutoComplete object was previously assigned to this edit control, /* If another AutoComplete object was previously assigned to this edit control,
release it but keep the same callback on the control, to avoid an infinite release it but keep the same callback on the control, to avoid an infinite
@ -163,20 +163,20 @@ HRESULT WINAPI CAutoComplete::Init(HWND hwndEdit, IUnknown *punkACL, LPCOLESTR p
if (prev && prev->m_initialized) if (prev && prev->m_initialized)
{ {
this->m_wpOrigEditProc = prev->m_wpOrigEditProc; m_wpOrigEditProc = prev->m_wpOrigEditProc;
SetPropW(m_hwndEdit, autocomplete_propertyW, this); SetPropW(m_hwndEdit, autocomplete_propertyW, this);
prev->m_wpOrigEditProc = NULL; prev->m_wpOrigEditProc = NULL;
prev->Release(); prev->Release();
} }
else else
{ {
SetPropW(this->m_hwndEdit, autocomplete_propertyW, (HANDLE)this); SetPropW(m_hwndEdit, autocomplete_propertyW, (HANDLE)this);
this->m_wpOrigEditProc = (WNDPROC)SetWindowLongPtrW(m_hwndEdit, GWLP_WNDPROC, (LONG_PTR)ACEditSubclassProc); m_wpOrigEditProc = (WNDPROC)SetWindowLongPtrW(m_hwndEdit, GWLP_WNDPROC, (LONG_PTR)ACEditSubclassProc);
} }
if (m_options & ACO_AUTOSUGGEST) if (m_options & ACO_AUTOSUGGEST)
{ {
this->CreateListbox(); CreateListbox();
} }
if (pwzsRegKeyPath) if (pwzsRegKeyPath)