On Wed Mar 4 17:45:53 2026 +0000, Esme Povirk wrote:
This would add a non-obvious corner case. We generally assume that there are only a few valid Graphics object types: Metafile recording, Bitmap, HWND, and HDC, and that has_gdi_dc divides them cleanly (Metafile/Bitmap do not have a DC, and HWND/HDC do). Based on my observations, the code, upon successfully checking `has_gdi_dc`, will proceed to call `gdi_dc_acquire` to obtain an `hdc` without any further checks. However, if the `graphics` was created using `GdipCreateFromHWND` and the corresponding `hwnd` has already been destroyed, the `hdc` cannot be obtained. This would cause Wine's behavior to differ from Windows. For this reason, I chose to add an extra check within `has_gdi_dc`. Perhaps you have a better suggestion?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10235#note_131339