edit send notification patch
Rein Klazes
rklazes at casema.net
Mon Apr 2 10:51:09 CDT 2001
Hi,
Pegasus mail client gets stuck in an endless recursion when replying
to an opened message. When one of the edits controls is filled with
the reply-adress, the following happens: Processing the WM_SETTEXT
message, the text is filled in in EDIT_EM_ReplaceSel(), which also
happens to send the WM_COMMAND notification message. When this message
is processed, the app's handler sends a message EM_GETSEL and inspects
the return value, if it is not zero it will send a new WM_SETTEXT
message. Under windows this value is zero (selectio star and end are
zero), but not under wine, where it recurses, exhausing the stack
space.
Changelog:
controls : edit.c
Do not send the EN_CHANGE notification message until the
selection start and end values are filled in.
Rein.
--
Rein Klazes
rklazes at casema.net
-------------- next part --------------
--- ./wine/controls/edit.c Sat Mar 31 08:21:49 2001
+++ ./mywine/controls/edit.c Mon Apr 2 16:51:14 2001
@@ -3615,8 +3615,10 @@
EDIT_EM_SetSel(wnd, es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
EDIT_EM_EmptyUndoBuffer(es);
- EDIT_EM_ReplaceSel(wnd, es, TRUE, utext, TRUE);
+ EDIT_EM_ReplaceSel(wnd, es, TRUE, utext, FALSE);
EDIT_EM_SetSel(wnd, es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
+ /* send the notification after the selection start and end are set */
+ EDIT_NOTIFY_PARENT(es, EN_CHANGE, "EN_CHANGE");
EDIT_EM_ScrollCaret(wnd, es);
HeapFree(GetProcessHeap(), 0, utext);
@@ -3824,13 +3826,15 @@
EDIT_EM_EmptyUndoBuffer(es);
if (name && *name) {
- EDIT_EM_ReplaceSel(wnd, es, FALSE, name, TRUE);
+ EDIT_EM_ReplaceSel(wnd, es, FALSE, name, FALSE);
/* if we insert text to the editline, the text scrolls out
* of the window, as the caret is placed after the insert
* pos normally; thus we reset es->selection... to 0 and
* update caret
*/
es->selection_start = es->selection_end = 0;
+ /* send the notification after the selection start and end are set */
+ EDIT_NOTIFY_PARENT(es, EN_CHANGE, "EN_CHANGE");
EDIT_EM_ScrollCaret(wnd, es);
}
/* force scroll info update */
@@ -4666,23 +4670,23 @@
EDIT_EM_SetSel(wnd, es, 0, (UINT)-1, FALSE);
if (text) {
TRACE("%s\n", debugstr_w(text));
- /* edit control doesn't send notification on WM_SETTEXT
- * if it is multiline, or it is part of combobox
- */
- EDIT_EM_ReplaceSel(wnd, es, FALSE, text, !((es->style & ES_MULTILINE) || es->hwndListBox));
+ EDIT_EM_ReplaceSel(wnd, es, FALSE, text, FALSE);
if(!unicode)
HeapFree(GetProcessHeap(), 0, text);
} else {
static const WCHAR empty_stringW[] = {0};
TRACE("<NULL>\n");
- /* edit control doesn't send notification on WM_SETTEXT
- * if it is multiline, or it is part of combobox
- */
- EDIT_EM_ReplaceSel(wnd, es, FALSE, empty_stringW, !((es->style & ES_MULTILINE) || es->hwndListBox));
+ EDIT_EM_ReplaceSel(wnd, es, FALSE, empty_stringW, FALSE);
}
es->x_offset = 0;
es->flags &= ~EF_MODIFIED;
EDIT_EM_SetSel(wnd, es, 0, 0, FALSE);
+ /* Send the notification after the selection start and end have been set
+ * edit control doesn't send notification on WM_SETTEXT
+ * if it is multiline, or it is part of combobox
+ */
+ if( !((es->style & ES_MULTILINE) || es->hwndListBox))
+ EDIT_NOTIFY_PARENT(es, EN_CHANGE, "EN_CHANGE");
EDIT_EM_ScrollCaret(wnd, es);
}
More information about the wine-patches
mailing list