Commit d89c4674 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

riched20: Don't access memory after freeing it.

parent 01e8eaef
......@@ -1812,18 +1812,20 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
LPWSTR wszText = ME_ToUnicode(hWnd, (void *)lParam);
size_t len = lstrlenW(wszText);
TRACE("EM_REPLACESEL - %s\n", debugstr_w(wszText));
ME_GetSelection(editor, &from, &to);
style = ME_GetSelectionInsertStyle(editor);
ME_InternalDeleteText(editor, from, to-from);
ME_InsertTextFromCursor(editor, 0, wszText, len, style);
ME_ReleaseStyle(style);
ME_EndToUnicode(hWnd, wszText);
/* drop temporary style if line end */
/* FIXME question: does abc\n mean: put abc, clear temp style, put \n? (would require a change) */
/*
* FIXME question: does abc\n mean: put abc,
* clear temp style, put \n? (would require a change)
*/
if (len>0 && wszText[len-1] == '\n')
ME_ClearTempStyle(editor);
ME_EndToUnicode(hWnd, wszText);
ME_CommitUndo(editor);
if (!wParam)
ME_EmptyUndoStack(editor);
......
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