Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48803 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=19239 Signed-off-by: Roman Pišl rpisl@seznam.cz --- dlls/comctl32/edit.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c index 2538eda4b6..6793a9818b 100644 --- a/dlls/comctl32/edit.c +++ b/dlls/comctl32/edit.c @@ -4489,6 +4489,14 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs) else if (es->style & WS_BORDER) SetWindowLongW(hwnd, GWL_STYLE, es->style & ~WS_BORDER);
+ /* + * To initialize some final structure members, we call some helper + * functions. However, since the EDITSTATE is not consistent (i.e. + * not fully initialized), we should be very careful which + * functions can be called, and in what order. + */ + EDIT_WM_SetFont(es, 0, FALSE); + return TRUE;
cleanup: @@ -4514,15 +4522,6 @@ static LRESULT EDIT_WM_Create(EDITSTATE *es, const WCHAR *name)
TRACE("%s\n", debugstr_w(name));
- /* - * To initialize some final structure members, we call some helper - * functions. However, since the EDITSTATE is not consistent (i.e. - * not fully initialized), we should be very careful which - * functions can be called, and in what order. - */ - EDIT_WM_SetFont(es, 0, FALSE); - EDIT_EM_EmptyUndoBuffer(es); - /* We need to calculate the format rect (applications may send EM_SETMARGINS before the control gets visible) */ GetClientRect(es->hwndSelf, &clientRect);
Please add a test that crashes without this change. Bug 19239 is linked to user32, so that should be addressed separately.
P.S. there is no need to more comment, or to remove EDIT_EM_EmptyUndoBuffer().
Hello Nikolay, bug 37144 is also marked as user32 and closed as duplicate of 19239 but also fixed by this. Should I mention the bug 37144 in commit message or will be properly re-closed in bugzilla?
My thought was - make the initialization early, it can't hurt anything, but it is also obvious that EDIT_EM_EmptyUndoBuffer is useless - the buffer is already zeroed by heap_alloc_zero() so the removal is intentional. Should I put it back to WM_Create?
Ok, will prepare tests.
Thanks Roman
Dne 25. 03. 20 v 11:52 Nikolay Sivov napsal(a):
Please add a test that crashes without this change. Bug 19239 is linked to user32, so that should be addressed separately.
P.S. there is no need to more comment, or to remove EDIT_EM_EmptyUndoBuffer().
On 3/25/20 2:12 PM, Roman Pišl wrote:
Hello Nikolay, bug 37144 is also marked as user32 and closed as duplicate of 19239 but also fixed by this. Should I mention the bug 37144 in commit message or will be properly re-closed in bugzilla?
It's better to mention ones that you tested. Those bugs are older than class redirection functionality, that's why it's confusing. If it turns out that all of them are using redirected classes, we'll switch components accordingly.
My thought was - make the initialization early, it can't hurt anything, but it is also obvious that EDIT_EM_EmptyUndoBuffer is useless - the buffer is already zeroed by heap_alloc_zero() so the removal is intentional. Should I put it back to WM_Create?
Right, I'm not suggesting this fix is incorrect, but it's important to have a test so we don't break it again. And yes, please keep EmptyUndoBuffer where it is, it's unrelated.
On 3/25/20 2:12 PM, Roman Pišl wrote:
Hello Nikolay, bug 37144 is also marked as user32 and closed as duplicate of 19239 but also fixed by this. Should I mention the bug 37144 in commit message or will be properly re-closed in bugzilla?
My thought was - make the initialization early, it can't hurt anything, but it is also obvious that EDIT_EM_EmptyUndoBuffer is useless - the buffer is already zeroed by heap_alloc_zero() so the removal is intentional. Should I put it back to WM_Create?
Ok, will prepare tests.
I've attached test diff to https://bugs.winehq.org/show_bug.cgi?id=48803 after your comment, which shows that moving initialization earlier has side effects.
Thanks Roman
Dne 25. 03. 20 v 11:52 Nikolay Sivov napsal(a):
Please add a test that crashes without this change. Bug 19239 is linked to user32, so that should be addressed separately.
P.S. there is no need to more comment, or to remove EDIT_EM_EmptyUndoBuffer().