[PATCH] winemac: Fix macdrv_WindowPosChanged behavior when SWP_HIDEWINDOW flag is used.
ken at codeweavers.com
Wed Mar 11 10:16:51 CDT 2020
On Mar 9, 2020, at 3:56 PM, Piotr Caban <piotr at codeweavers.com> wrote:
> In this case surface points to dummy surface or NULL. Later e.g. set_window_surface assumes that it was created by Mac driver.
> diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c
> index 605c0c87f1..e2e8cc3f13 100644
> --- a/dlls/winemac.drv/window.c
> +++ b/dlls/winemac.drv/window.c
> @@ -2119,7 +2119,7 @@ void CDECL macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags,
> data->window_rect = *window_rect;
> data->whole_rect = *visible_rect;
> data->client_rect = *client_rect;
> - if (data->cocoa_window && !data->ulw_layered)
> + if (data->cocoa_window && !data->ulw_layered && !(swp_flags & SWP_HIDEWINDOW))
> if (surface) window_surface_add_ref(surface);
> if (new_style & WS_MINIMIZE)
Hmm. This means that when a window is hidden, we don't release its surface, which can be a large allocation.
I think the right fix would be something like changing get_mac_surface() in surface.c to check surface->funcs against &macdrv_surface_funcs and returning NULL if it's not one of ours. Then, check the return in the appropriate places (in a number of places where it's called we know for sure that it's one of ours).
More information about the wine-devel