<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div>Here is the revised patch.</div><div><br></div><div>Kind regards,</div><div>Alexander Täschner<br>---<br> src/win32/cairo-win32-device.<wbr>c | 2 ++<br> 1 file changed, 2 insertions(+)</div><div>diff --git a/src/win32/cairo-win32-<wbr>device.c b/src/win32/cairo-win32-<wbr>device.c<br>index 741e49e..3e959f6 100644<br>--- a/src/win32/cairo-win32-<wbr>device.c<br>+++ b/src/win32/cairo-win32-<wbr>device.c<br>@@ -131,6 +131,8 @@ _cairo_win32_device_get (void)<br> {<br>     cairo_win32_device_t *device;<br> <br>+ CAIRO_MUTEX_INITIALIZE ();<br>+<br>     if (__cairo_win32_device)<br>  return cairo_device_reference (__cairo_win32_device);<span class="HOEnZb"><font color="#888888"><br> <br>-- <br>2.10.2.windows.1</font></span></div><div><span><br></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-06-10 14:38 GMT+02:00 Uli Schlachter <span dir="ltr"><<a href="mailto:psychon@znc.in" target="_blank">psychon@znc.in</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div class="m_3005179407224145147HOEnZb"><div class="m_3005179407224145147h5">On 07.06.2017 16:01, Alexander Täschner wrote:<br>
> For static builds for win32 the mutexes are not initialized (for dynamic<br>
> builds its done when the DLL is loaded). Therefore the patch add<br>
> initialization to the create surface calls.<br>
><br>
> ---<br>
>  src/win32/cairo-win32-display-<wbr>surface.c | 8 ++++++--<br>
>  1 file changed, 6 insertions(+), 2 deletions(-)<br>
> diff --git a/src/win32/cairo-win32-displa<wbr>y-surface.c<br>
> b/src/win32/cairo-win32-displa<wbr>y-surface.c<br>
> index 025b2c9..56f0e65 100644<br>
> --- a/src/win32/cairo-win32-displa<wbr>y-surface.c<br>
> +++ b/src/win32/cairo-win32-displa<wbr>y-surface.c<br>
> @@ -953,7 +953,9 @@ cairo_win32_surface_create_wit<wbr>h_format (HDC hdc,<br>
> cairo_format_t format)<br>
>      case CAIRO_FORMAT_RGB24:<br>
>   break;<br>
>      }<br>
> -<br>
> +#if CAIRO_WIN32_STATIC_BUILD<br>
> +    CAIRO_MUTEX_INITIALIZE ();<br>
> +#endif<br>
>      surface = malloc (sizeof (*surface));<br>
>      if (surface == NULL)<br>
>   return _cairo_surface_create_in_error (_cairo_error<br>
> (CAIRO_STATUS_NO_MEMORY));<br>
> @@ -1031,7 +1033,9 @@ cairo_win32_surface_create_wit<wbr>h_dib (cairo_format_t<br>
> format,<br>
>  {<br>
>      if (! CAIRO_FORMAT_VALID (format))<br>
>   return _cairo_surface_create_in_error (_cairo_error<br>
> (CAIRO_STATUS_INVALID_FORMAT))<wbr>;<br>
> -<br>
> +#if CAIRO_WIN32_STATIC_BUILD<br>
> +    CAIRO_MUTEX_INITIALIZE ();<br>
> +#endif<br>
>      return _cairo_win32_display_surface_c<wbr>reate_for_dc (NULL, format,<br>
> width, height);<br>
>  }<br>
<br>
</div></div>I would suggest doing the above unconditionally (without the #if).<br>
<br>
Also, how about moving this to the beginning of<br>
_cairo_win32_device_get()? That sounds central enough that every code<br>
path in the win32 backend should go through it.<br>
<span class="m_3005179407224145147HOEnZb"><font color="#888888"><br>
Uli<br>
--<br>
99 little bugs in the code<br>
99 little bugs in the code<br>
Take one down, patch it around<br>
117 little bugs in the code<br>
  -- @irqed<br>
</font></span></blockquote></div><br></div>
</div></div></div><br></div>