summaryrefslogtreecommitdiff
path: root/recipes/pango/0001-win32-Fix-32bit-build-crash-on-DeleteDC.patch
blob: b489a968d650f10964c169390cea6144645dbe4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 564de11dab6422d980fbb5b83e2b452a21708032 Mon Sep 17 00:00:00 2001
From: Seungha Yang <seungha@centricular.com>
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 eed92dde..fbedaa74 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -125,7 +125,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);
 
 HDC
 _pango_win32_get_display_dc (void)
-- 
2.35.3.windows.1