Alexandros Frantzis (@afrantzis) commented about dlls/winewayland.drv/wayland_surface.c:
+ +/********************************************************************** + * wayland_surface_set_icon + */ +void wayland_surface_set_icon(struct wayland_surface *surface, UINT type, ICONINFO* ii) +{ + HDC hDC; + struct wayland_shm_buffer *icon_buf; + + if (!ii) return; + + hDC = NtGdiCreateCompatibleDC(0); + icon_buf = wayland_shm_buffer_from_color_bitmaps(hDC, ii->hbmColor, ii->hbmMask); + NtGdiDeleteObjectApp(hDC); + + if (surface->xdg_toplevel) We can also assert this instead and ensure we don't call this on non-toplevels (see other suggestions). In fact, since `surface->xdg_toplevel` is part of union, the proper way to assert would be:
`assert(surface->role == WAYLAND_SURFACE_ROLE_TOPLEVEL && surface->xdg_toplevel);` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6938#note_99490