Index: dll/win32/shell32/shlview.c =================================================================== --- dll/win32/shell32/shlview.c (revision 50950) +++ dll/win32/shell32/shlview.c (working copy) @@ -1475,7 +1475,7 @@ case LVN_ENDLABELEDITW: { - TRACE("-- LVN_ENDLABELEDITA %p\n",This); + TRACE("-- LVN_ENDLABELEDITW %p\n",This); if (lpdi->item.pszText) { HRESULT hr; Index: dll/win32/user32/controls/edit.c =================================================================== --- dll/win32/user32/controls/edit.c (revision 50950) +++ dll/win32/user32/controls/edit.c (working copy) @@ -4367,9 +4367,9 @@ cleanup: SetWindowLongPtrW(es->hwndSelf, 0, 0); - HeapFree(GetProcessHeap(), 0, es->first_line_def); - HeapFree(GetProcessHeap(), 0, es->undo_text); - if (es->hloc32W) LocalFree(es->hloc32W); + if (es->first_line_def) HeapFree(GetProcessHeap(), 0, es->first_line_def); + if (es->undo_text) HeapFree(GetProcessHeap(), 0, es->undo_text); + LocalFree(es->hloc32W); HeapFree(GetProcessHeap(), 0, es); return FALSE; } @@ -4434,12 +4434,8 @@ { LINEDEF *pc, *pp; - if (es->hloc32W) { - LocalFree(es->hloc32W); - } - if (es->hloc32A) { - LocalFree(es->hloc32A); - } + LocalFree(es->hloc32W); + LocalFree(es->hloc32A); pc = es->first_line_def; while (pc) { @@ -4448,8 +4444,8 @@ pc = pp; } - SetWindowLongPtrW( es->hwndSelf, 0, 0 ); - HeapFree(GetProcessHeap(), 0, es->undo_text); + SetWindowLongPtrW(es->hwndSelf, 0, 0); + HeapFree(GetProcessHeap(), 0, es->undo_text); HeapFree(GetProcessHeap(), 0, es); return 0; @@ -4734,7 +4730,6 @@ case WM_DESTROY: result = EDIT_WM_Destroy(es); - es = NULL; #ifdef __REACTOS__ NtUserSetWindowFNID(hwnd, FNID_DESTROY); #endif @@ -5022,9 +5017,11 @@ break; } - if (IsWindow(hwnd) && es) EDIT_UnlockBuffer(es, FALSE); + /* check GetWindowLong in case es has been destroyed during processing */ + if (IsWindow(hwnd) && es && GetWindowLongPtrW(hwnd, 0)) + EDIT_UnlockBuffer(es, FALSE); - TRACE("hwnd=%p msg=%x (%s) -- 0x%08lx\n", hwnd, msg, SPY_GetMsgName(msg, hwnd), result); + TRACE("hwnd=%p msg=%x (%s) -- 0x%08lx\n", hwnd, msg, SPY_GetMsgName(msg, hwnd), result); return result; }