https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a777cc2cc4768bd25190863d4aeef7cbd356841c

commit a777cc2cc4768bd25190863d4aeef7cbd356841c
Author:     Atharva Kulkarni <[email protected]>
AuthorDate: Tue Feb 14 01:15:39 2023 +0530
Commit:     GitHub <[email protected]>
CommitDate: Mon Feb 13 20:45:39 2023 +0100

    [EXPLORER] Fix crash on backspace while editing a label in the folder panel 
(#5059)
    
    While editing a label, accelerator events should not be propagated.
---
 dll/win32/browseui/explorerband.cpp | 8 ++++++++
 dll/win32/browseui/explorerband.h   | 1 +
 2 files changed, 9 insertions(+)

diff --git a/dll/win32/browseui/explorerband.cpp 
b/dll/win32/browseui/explorerband.cpp
index 83b5d8c3396..dcab4f4455b 100644
--- a/dll/win32/browseui/explorerband.cpp
+++ b/dll/win32/browseui/explorerband.cpp
@@ -149,6 +149,7 @@ CExplorerBand::CExplorerBand()
     , m_fVisible(FALSE)
     , m_bNavigating(FALSE)
     , m_dwBandID(0)
+    , m_isEditing(FALSE)
     , m_pidlCurrent(NULL)
 {
 }
@@ -1217,6 +1218,9 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::HasFocusIO()
 
 HRESULT STDMETHODCALLTYPE CExplorerBand::TranslateAcceleratorIO(LPMSG lpMsg)
 {
+    if (m_isEditing)
+        return S_FALSE;
+
     if (lpMsg->hwnd == m_hWnd)
     {
         TranslateMessage(lpMsg);
@@ -1314,7 +1318,10 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND 
hWnd, UINT uMsg, WPARAM
 
                 hr = pParent->GetAttributesOf(1, &pChild, &dwAttr);
                 if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME) && theResult)
+                {
                     *theResult = 0;
+                    m_isEditing = TRUE;
+                }
                 return S_OK;
             }
             case TVN_ENDLABELEDITW:
@@ -1323,6 +1330,7 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND 
hWnd, UINT uMsg, WPARAM
                 NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
                 HRESULT hr;
 
+                m_isEditing = FALSE;
                 if (theResult)
                     *theResult = 0;
                 if (dispInfo->item.pszText)
diff --git a/dll/win32/browseui/explorerband.h 
b/dll/win32/browseui/explorerband.h
index a4d5aa98666..6e48e944053 100644
--- a/dll/win32/browseui/explorerband.h
+++ b/dll/win32/browseui/explorerband.h
@@ -60,6 +60,7 @@ private:
     BOOL m_bNavigating;
     BOOL m_bFocused;
     DWORD m_dwBandID;
+    BOOL m_isEditing;
     HIMAGELIST m_hImageList;
     HTREEITEM  m_hRoot;
     HTREEITEM  m_oldSelected;

Reply via email to