Commit 8138159f authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Defer releasing the host if inside a notify callback.

parent 77f59665
...@@ -44,11 +44,13 @@ struct host ...@@ -44,11 +44,13 @@ struct host
unsigned int client_edge : 1; unsigned int client_edge : 1;
unsigned int use_set_rect : 1; unsigned int use_set_rect : 1;
unsigned int use_back_colour : 1; unsigned int use_back_colour : 1;
unsigned int defer_release : 1;
PARAFORMAT2 para_fmt; PARAFORMAT2 para_fmt;
DWORD props, scrollbars, event_mask; DWORD props, scrollbars, event_mask;
RECT client_rect, set_rect; RECT client_rect, set_rect;
COLORREF back_colour; COLORREF back_colour;
WCHAR password_char; WCHAR password_char;
unsigned int notify_level;
}; };
static const ITextHost2Vtbl textHostVtbl; static const ITextHost2Vtbl textHostVtbl;
...@@ -118,6 +120,8 @@ struct host *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL emulate_10 ) ...@@ -118,6 +120,8 @@ struct host *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL emulate_10 )
GetClientRect( hwnd, &texthost->client_rect ); GetClientRect( hwnd, &texthost->client_rect );
texthost->use_back_colour = 0; texthost->use_back_colour = 0;
texthost->password_char = (texthost->props & TXTBIT_USEPASSWORD) ? '*' : 0; texthost->password_char = (texthost->props & TXTBIT_USEPASSWORD) ? '*' : 0;
texthost->defer_release = 0;
texthost->notify_level = 0;
return texthost; return texthost;
} }
...@@ -1098,12 +1102,24 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam, ...@@ -1098,12 +1102,24 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
if ((((host->event_mask & ENM_KEYEVENTS) && msg >= WM_KEYFIRST && msg <= WM_KEYLAST) || if ((((host->event_mask & ENM_KEYEVENTS) && msg >= WM_KEYFIRST && msg <= WM_KEYLAST) ||
((host->event_mask & ENM_MOUSEEVENTS) && msg >= WM_MOUSEFIRST && msg <= WM_MOUSELAST) || ((host->event_mask & ENM_MOUSEEVENTS) && msg >= WM_MOUSEFIRST && msg <= WM_MOUSELAST) ||
((host->event_mask & ENM_SCROLLEVENTS) && msg >= WM_HSCROLL && msg <= WM_VSCROLL)) && ((host->event_mask & ENM_SCROLLEVENTS) && msg >= WM_HSCROLL && msg <= WM_VSCROLL)))
send_msg_filter( host, msg, &wparam, &lparam ))
{ {
TRACE( "exit (filtered) hwnd %p msg %04x (%s) %lx %lx -> %lu\n", host->notify_level++;
hwnd, msg, get_msg_name(msg), wparam, lparam, res ); res = send_msg_filter( host, msg, &wparam, &lparam );
return res; if (!--host->notify_level && host->defer_release)
{
TRACE( "exit (filtered deferred release) hwnd %p msg %04x (%s) %lx %lx -> 0\n",
hwnd, msg, get_msg_name(msg), wparam, lparam );
ITextHost2_Release( &host->ITextHost_iface );
return 0;
}
if (res)
{
TRACE( "exit (filtered %lu) hwnd %p msg %04x (%s) %lx %lx -> 0\n",
res, hwnd, msg, get_msg_name(msg), wparam, lparam );
return 0;
}
} }
switch (msg) switch (msg)
...@@ -1139,7 +1155,8 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam, ...@@ -1139,7 +1155,8 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
break; break;
} }
case WM_DESTROY: case WM_DESTROY:
ITextHost2_Release( &host->ITextHost_iface ); if (!host->notify_level) ITextHost2_Release( &host->ITextHost_iface );
else host->defer_release = 1;
return 0; return 0;
case WM_ERASEBKGND: case WM_ERASEBKGND:
......
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