Commit 6356a441 authored by Alexandre Julliard's avatar Alexandre Julliard

Authors: Sander van Leeuwen <sandervl@xs4all.nl>, Dietrich Teickner <Dietrich_Teickner@t-online.de>

- Fixed incorrect undo buffer size (previous code caused heap corruption when using backspace many times). - Always kill timer when left mouse button is released and in captured state.
parent def211c4
...@@ -1747,7 +1747,7 @@ static BOOL EDIT_MakeUndoFit(EDITSTATE *es, UINT size) ...@@ -1747,7 +1747,7 @@ static BOOL EDIT_MakeUndoFit(EDITSTATE *es, UINT size)
alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR)); alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR));
if ((es->undo_text = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, es->undo_text, alloc_size))) { if ((es->undo_text = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, es->undo_text, alloc_size))) {
es->undo_buffer_size = alloc_size/sizeof(WCHAR); es->undo_buffer_size = alloc_size/sizeof(WCHAR) - 1;
return TRUE; return TRUE;
} }
else else
...@@ -4216,9 +4216,9 @@ static LRESULT EDIT_WM_LButtonDown(EDITSTATE *es, DWORD keys, INT x, INT y) ...@@ -4216,9 +4216,9 @@ static LRESULT EDIT_WM_LButtonDown(EDITSTATE *es, DWORD keys, INT x, INT y)
*/ */
static LRESULT EDIT_WM_LButtonUp(EDITSTATE *es) static LRESULT EDIT_WM_LButtonUp(EDITSTATE *es)
{ {
if (es->bCaptureState && GetCapture() == es->hwndSelf) { if (es->bCaptureState) {
KillTimer(es->hwndSelf, 0); KillTimer(es->hwndSelf, 0);
ReleaseCapture(); if (GetCapture() == es->hwndSelf) ReleaseCapture();
} }
es->bCaptureState = FALSE; es->bCaptureState = FALSE;
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment