[PATCH] Initialize mutexes for static builds for win32

Alexander Täschner <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAAfZOfok-9vP6EY-mE8T3yCnJK3DwO2BVzamdeKqWyqJydBkJA@mail.gmail.com>
For static builds for win32 the mutexes are not initialized (for dynamic
builds its done when the DLL is loaded). Therefore the patch add
initialization to the create surface calls.

---
 src/win32/cairo-win32-display-surface.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/win32/cairo-win32-display-surface.c
b/src/win32/cairo-win32-display-surface.c
index 025b2c9..56f0e65 100644
--- a/src/win32/cairo-win32-display-surface.c
+++ b/src/win32/cairo-win32-display-surface.c
@@ -953,7 +953,9 @@ cairo_win32_surface_create_with_format (HDC hdc,
cairo_format_t format)
     case CAIRO_FORMAT_RGB24:
  break;
     }
-
+#if CAIRO_WIN32_STATIC_BUILD
+    CAIRO_MUTEX_INITIALIZE ();
+#endif
     surface = malloc (sizeof (*surface));
     if (surface == NULL)
  return _cairo_surface_create_in_error (_cairo_error
(CAIRO_STATUS_NO_MEMORY));
@@ -1031,7 +1033,9 @@ cairo_win32_surface_create_with_dib (cairo_format_t
format,
 {
     if (! CAIRO_FORMAT_VALID (format))
  return _cairo_surface_create_in_error (_cairo_error
(CAIRO_STATUS_INVALID_FORMAT));
-
+#if CAIRO_WIN32_STATIC_BUILD
+    CAIRO_MUTEX_INITIALIZE ();
+#endif
     return _cairo_win32_display_surface_create_for_dc (NULL, format,
width, height);
 }

-- 
2.10.2.windows.1

-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.