Hi,<br><br>Having just rebuilt the pixman library (I was checking that all the dependencies were using the /MDd flag) I can no longer reproduce the crash.   Initially I suspected that because pixman uses /MD for both release and debug that this could have been the cause.  But having tried to build with /MD again I cannot reproduce.  So I am putting this down to a bad build of pixman.<br>
<br>Thanks for your suggestions.<br><br>Daz<br><br><div class="gmail_quote">2009/4/27 Darren Gallagher <span dir="ltr">&lt;<a href="mailto:dazzag@gmail.com">dazzag@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>Just tried adding in the call to cairo_surface_finish().   It still crashes.  Code now as follows:<div class="im"><br><br>cairo_surface_t *surface;<br>    cairo_t *cr;<br> <br>    surface = cairo_pdf_surface_create (&quot;hellocairo.pdf&quot; , 504, 648);<br>

    cr = cairo_create (surface);<br>    cairo_set_source_rgb(cr, 0, 0, 0);<br>    cairo_select_font_face (cr, &quot;serif&quot;, CAIRO_FONT_SLANT_NORMAL,  CAIRO_FONT_WEIGHT_NORMAL);<br>    cairo_set_font_size (cr, 40.0);<br>

    cairo_move_to(cr, 10.0, 50.0);<br>    cairo_show_text(cr, &quot;Hello, Cairo!&quot;);<br></div>    //drawDashLine(cr);<br>    cairo_show_page(cr);<br>    cairo_surface_finish(surface);<div class="im"><br>    cairo_surface_destroy(surface);<br>

    cairo_destroy(cr);<br><br></div>Stack trace:<div class="im"><br><br>     ntdll.dll!7c90120e()     <br>     [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]    <br></div><div class="im">
     ntdll.dll!7c96e139()     <br>     ntdll.dll!7c96e576()     <br>
     ntdll.dll!7c9622e8()     <br>     kernel32.dll!7c85f9a7()     <br></div>     msvcr80d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x00955c48)  Line 2072    C++<br>     msvcr80d.dll!_free_dbg_nolock(void * pUserData=0x00955c48, int nBlockUse=1)  Line 1279 + 0x9 bytes    C++<br>

     msvcr80d.dll!_free_dbg(void * pUserData=0x00955c48, int nBlockUse=1)  Line 1220 + 0xd bytes    C++<br>     msvcr80d.dll!free(void * pUserData=0x00955c48)  Line 1178 + 0xb bytes    C++<br>     libcairod.dll!_cairo_truetype_subset_fini(_cairo_truetype_subset * subset=0x0012f4c0)  Line 1171 + 0xe bytes    C<br>

     libcairod.dll!_cairo_pdf_surface_emit_truetype_font_subset(_cairo_pdf_surface * surface=0x00436fe0, _cairo_scaled_font_subset * font_subset=0x0012f75c)  Line 3451 + 0xc bytes    C<br>     libcairod.dll!_cairo_pdf_surface_emit_unscaled_font_subset(_cairo_scaled_font_subset * font_subset=0x0012f75c, void * closure=0x00436fe0)  Line 3722 + 0xd bytes    C<br>

     libcairod.dll!_cairo_sub_font_collect(void * entry=0x0043af78, void * closure=0x0012f8a8)  Line 578 + 0x15 bytes    C<div class="im"><br>     libcairod.dll!_cairo_scaled_font_subsets_foreach_internal(_cairo_scaled_font_subsets * font_subsets=0x004386b8, _cairo_status (_cairo_scaled_font_subset *, void *)* font_subset_callback=0x100b67a0, void * closure=0x00436fe0, cairo_subsets_foreach_type_t type=CAIRO_SUBSETS_FOREACH_UNSCALED)  Line 889 + 0xd bytes    C<br>

     libcairod.dll!_cairo_scaled_font_subsets_foreach_unscaled(_cairo_scaled_font_subsets * font_subsets=0x004386b8, _cairo_status (_cairo_scaled_font_subset *, void *)* font_subset_callback=0x100b67a0, void * closure=0x00436fe0)  Line 918 + 0x13 bytes    C<br>

     libcairod.dll!_cairo_pdf_surface_emit_font_subsets(_cairo_pdf_surface * surface=0x00436fe0)  Line 3774 + 0x18 bytes    C<br>     libcairod.dll!_cairo_pdf_surface_finish(void * abstract_surface=0x00436fe0)  Line 1195 + 0x9 bytes    C<br>

     libcairod.dll!cairo_surface_finish(_cairo_surface * surface=0x00436fe0)  Line 530 + 0x10 bytes    C<br>     libcairod.dll!_cairo_paginated_surface_finish(void * abstract_surface=0x00433998)  Line 172 + 0xf bytes    C<br>

     libcairod.dll!cairo_surface_finish(_cairo_surface * surface=0x00433998)  Line 530 + 0x10 bytes    C<br></div>&gt;    hellocairo.exe!main(int argc=2, char * * argv=0x00436f58)  Line 48 + 0xc bytes    C<div class="im">
<br>     hellocairo.exe!__tmainCRTStartup()  Line 597 + 0x19 bytes    C<br>
     hellocairo.exe!mainCRTStartup()  Line 414    C<br></div>     kernel32.dll!7c817077()     <br><br>Thanks<br><br><div class="gmail_quote"><div class="im">2009/4/24 Behdad Esfahbod <span dir="ltr">&lt;<a href="mailto:behdad@behdad.org" target="_blank">behdad@behdad.org</a>&gt;</span><br>

</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>On 04/24/2009 11:59 AM, Gerdus van Zyl wrote:<div><div></div><div class="h5"><br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Try reversing the lines:<br>
     cairo_surface_destroy(surface);<br>
     cairo_destroy(cr);<br>
<br>
destroying the surface before the context looks suspect. and when<br>
working with PDF you might want a cairo_surface_finish before<br>
destroying.<br>
</blockquote>
<br></div></div></div><div><div></div><div class="h5">
The context has a reference to the surface.  And _finish should be called automatically *if* the last reference to the surface is dropped.  So, calling it would be a good test to see if that&#39;s the problem.<br><font color="#888888">
<br>
behdad</font><div><div></div><div><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Fri, Apr 24, 2009 at 4:17 PM, Darren Gallagher&lt;<a href="mailto:dazzag@gmail.com" target="_blank">dazzag@gmail.com</a>&gt;  wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Using 1.8.6 on windows (with pixman 0.15.2).  Built using instructions here:<br>
<a href="http://www.williamcyap.com/software/cairo-lib/compiling-cairo-for-windows.xhtml" target="_blank">http://www.williamcyap.com/software/cairo-lib/compiling-cairo-for-windows.xhtml</a><br>
<br>
produces a crash witin cairo_destroy() somewhere.<br>
<br>
The code is as follows:<br>
<br>
#include&lt;cairo.h&gt;<br>
#include&lt;cairo-pdf.h&gt;<br>
<br>
int main (int argc, char *argv[])<br>
{<br>
     cairo_surface_t *surface;<br>
     cairo_t *cr;<br>
<br>
     surface = cairo_pdf_surface_create (&quot;hellocairo.pdf&quot; , 504, 648);<br>
     cr = cairo_create (surface);<br>
     cairo_set_source_rgb(cr, 0, 0, 0);<br>
     cairo_select_font_face (cr, &quot;serif&quot;, CAIRO_FONT_SLANT_NORMAL,<br>
CAIRO_FONT_WEIGHT_NORMAL);<br>
     cairo_set_font_size (cr, 40.0);<br>
     cairo_move_to(cr, 10.0, 50.0);<br>
     cairo_show_text(cr, &quot;Hello, Cairo!&quot;);<br>
     cairo_show_page(cr);<br>
     cairo_surface_destroy(surface);<br>
     cairo_destroy(cr);<br>
<br>
     return 0;<br>
}<br>
<br>
the stack is as follows:<br>
<br>
      ntdll.dll!7c90120e()<br>
      [Frames below may be incorrect and/or missing, no symbols loaded for<br>
ntdll.dll]<br>
      ntdll.dll!7c96c201()<br>
      ntdll.dll!7c96c63e()<br>
      ntdll.dll!7c9603b0()<br>
      kernel32.dll!7c85f8d7()<br>
      msvcr80d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x00955c50)<br>
Line 2072    C++<br>
      msvcr80d.dll!_free_dbg_nolock(void * pUserData=0x00955c50, int<br>
nBlockUse=1)  Line 1279 + 0x9 bytes    C++<br>
      msvcr80d.dll!_free_dbg(void * pUserData=0x00955c50, int nBlockUse=1)<br>
Line 1220 + 0xd bytes    C++<br>
      msvcr80d.dll!free(void * pUserData=0x00955c50)  Line 1178 + 0xb<br>
bytes    C++<br>
      libcairod.dll!_cairo_truetype_subset_fini(_cairo_truetype_subset *<br>
subset=0x0012f22c)  Line 1171 + 0xe bytes    C<br>
<br>
libcairod.dll!_cairo_pdf_surface_emit_truetype_font_subset(_cairo_pdf_surface<br>
* surface=0x00436fe0, _cairo_scaled_font_subset * font_subset=0x0012f4c8)<br>
Line 3451 + 0xc bytes    C<br>
<br>
libcairod.dll!_cairo_pdf_surface_emit_unscaled_font_subset(_cairo_scaled_font_subset<br>
* font_subset=0x0012f4c8, void * closure=0x00436fe0)  Line 3722 + 0xd<br>
bytes    C<br>
      libcairod.dll!_cairo_sub_font_collect(void * entry=0x0043af78, void *<br>
closure=0x0012f614)  Line 578 + 0x15 bytes    C<br>
<br>
libcairod.dll!_cairo_scaled_font_subsets_foreach_internal(_cairo_scaled_font_subsets<br>
* font_subsets=0x004386b8, _cairo_status (_cairo_scaled_font_subset *, void<br>
*)* font_subset_callback=0x100b67a0, void * closure=0x00436fe0,<br>
cairo_subsets_foreach_type_t type=CAIRO_SUBSETS_FOREACH_UNSCALED)  Line 889<br>
+ 0xd bytes    C<br>
<br>
libcairod.dll!_cairo_scaled_font_subsets_foreach_unscaled(_cairo_scaled_font_subsets<br>
* font_subsets=0x004386b8, _cairo_status (_cairo_scaled_font_subset *, void<br>
*)* font_subset_callback=0x100b67a0, void * closure=0x00436fe0)  Line 918 +<br>
0x13 bytes    C<br>
      libcairod.dll!_cairo_pdf_surface_emit_font_subsets(_cairo_pdf_surface *<br>
surface=0x00436fe0)  Line 3774 + 0x18 bytes    C<br>
      libcairod.dll!_cairo_pdf_surface_finish(void *<br>
abstract_surface=0x00436fe0)  Line 1195 + 0x9 bytes    C<br>
      libcairod.dll!cairo_surface_finish(_cairo_surface *<br>
surface=0x00436fe0)  Line 530 + 0x10 bytes    C<br>
      libcairod.dll!_cairo_paginated_surface_finish(void *<br>
abstract_surface=0x00433998)  Line 172 + 0xf bytes    C<br>
      libcairod.dll!cairo_surface_finish(_cairo_surface *<br>
surface=0x00433998)  Line 530 + 0x10 bytes    C<br>
      libcairod.dll!cairo_surface_destroy(_cairo_surface *<br>
surface=0x00433998)  Line 435 + 0x9 bytes    C<br>
      libcairod.dll!_cairo_gstate_fini(_cairo_gstate * gstate=0x00438a30)<br>
Line 205 + 0xf bytes    C<br>
      libcairod.dll!cairo_destroy(_cairo * cr=0x00438a10)  Line 228 + 0xc<br>
bytes    C<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
     hellocairo.exe!main(int argc=2, char * * argv=0x00436f58)  Line 49 +<br>
0xc bytes    C<br>
</blockquote>
      hellocairo.exe!__tmainCRTStartup()  Line 597 + 0x19 bytes    C<br>
      hellocairo.exe!mainCRTStartup()  Line 414    C<br>
      kernel32.dll!7c817067()<br>
<br>
Any help appreciated.<br>
<br>
Thanks<br>
<br>
Daz<br>
<br>
<br>
_______________________________________________<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org" target="_blank">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a><br>
<br>
</blockquote>
_______________________________________________<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org" target="_blank">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a><br>
<br>
</blockquote>
</div></div></div></div></blockquote></div><br>
</blockquote></div><br>