[vlc-devel] [PATCH] win32/drawable: process the WM_SIZE asynchronously
Thomas Guillem
thomas at gllm.fr
Mon Feb 22 08:14:27 UTC 2021
Lgtm
On Mon, Feb 22, 2021, at 08:25, Steve Lhomme wrote:
> The vout_window_ReportSize call may make changes in underlying HWND's which in
> turn might make reentrant calls to WinVoutEventProc, which might in turn call
> WM_SIZE in the same stack (when resizing quickly).
>
> vout_window_ReportSize() is not reentrant so we should avoid calling it in
> calls that might be reentrant (WM_SIZE in this case).
>
> We keep the latest WM_SIZE so when the asynchronous call is done, we already
> have the most up to date value.
> ---
> modules/video_output/win32/drawable.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/modules/video_output/win32/drawable.c
> b/modules/video_output/win32/drawable.c
> index 90106558848..c6f2f573a2f 100644
> --- a/modules/video_output/win32/drawable.c
> +++ b/modules/video_output/win32/drawable.c
> @@ -77,6 +77,8 @@ struct drawable_sys
> HWND hWnd;
> HWND embed_hwnd;
> RECT rect_parent;
> +
> + unsigned int width, height;
> };
>
> static LRESULT CALLBACK WinVoutEventProc(HWND hwnd, UINT message,
> @@ -131,7 +133,13 @@ static LRESULT CALLBACK WinVoutEventProc(HWND
> hwnd, UINT message,
> return 0;
>
> case WM_SIZE:
> - vout_window_ReportSize(wnd, LOWORD(lParam), HIWORD(lParam));
> + sys->width = LOWORD(lParam);
> + sys->height = HIWORD(lParam);
> + PostMessage(hwnd, WM_USER, 0, lParam);
> + return 0;
> +
> + case WM_USER:
> + vout_window_ReportSize(wnd, sys->width, sys->height);
> return 0;
>
> default:
> --
> 2.29.2
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list