From b4c5e9ff7e5c0b70b8a4549fc89931b58034c426 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Fri, 26 May 2023 20:23:47 +0900 Subject: [PATCH] win32: Fix 32bit build crash on DeleteDC() Calling convention mismatch will result in crash or so Fixes: https://gitlab.gnome.org/GNOME/pango/-/issues/749 --- pango/pangowin32.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pango/pangowin32.c b/pango/pangowin32.c index 7b6325a5c..4e9dc6c44 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -126,7 +126,15 @@ _pango_win32_font_init (PangoWin32Font *win32font) win32font->glyph_info = g_hash_table_new_full (NULL, NULL, NULL, g_free); } -static GPrivate display_dc_key = G_PRIVATE_INIT ((GDestroyNotify) DeleteDC); +static void +_delete_dc (HDC dc) +{ + /* Don't pass DeleteDC func pointer to the GDestroyNotify. + * 32bit build requires matching calling convention (__cdecl vs __stdcall) */ + DeleteDC (dc); +} + +static GPrivate display_dc_key = G_PRIVATE_INIT ((GDestroyNotify) _delete_dc); static GPrivate dwrite_items = G_PRIVATE_INIT ((GDestroyNotify) pango_win32_dwrite_items_destroy); HDC -- GitLab