[BROWSEUI] Fix crash while editing a label in the folder tree

+ Add a missing break
CORE-18646
This commit is contained in:
Mark Jansen 2023-02-13 23:19:55 +01:00
parent 2f6f24d0f6
commit 460a01b167
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B

View file

@ -1218,10 +1218,8 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::HasFocusIO()
HRESULT STDMETHODCALLTYPE CExplorerBand::TranslateAcceleratorIO(LPMSG lpMsg)
{
if (m_isEditing)
return S_FALSE;
if (lpMsg->hwnd == m_hWnd)
if (lpMsg->hwnd == m_hWnd ||
(m_isEditing && IsChild(lpMsg->hwnd)))
{
TranslateMessage(lpMsg);
DispatchMessage(lpMsg);
@ -1298,6 +1296,7 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
case TVN_BEGINDRAG:
case TVN_BEGINRDRAG:
OnTreeItemDragging((LPNMTREEVIEW)lParam, pNotifyHeader->code == TVN_BEGINRDRAG);
break;
case TVN_BEGINLABELEDITW:
{
// TODO: put this in a function ? (mostly copypasta from CDefView)
@ -1317,9 +1316,10 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
return E_FAIL;
hr = pParent->GetAttributesOf(1, &pChild, &dwAttr);
if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME) && theResult)
if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME))
{
*theResult = 0;
if (theResult)
*theResult = 0;
m_isEditing = TRUE;
}
return S_OK;