Hi,<br><br>I'm afraid this still crashes. Stack trace shows crash originating from cairo_surface_destroy() now rather than cairo_destroy()<br><br> ntdll.dll!7c90120e() <br> [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] <br>
ntdll.dll!7c96e139() <br> ntdll.dll!7c96e576() <br> ntdll.dll!7c9622e8() <br> kernel32.dll!7c85f9a7() <br> 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=0x0012f3e8) 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=0x0012f684) Line 3451 + 0xc bytes C<br>
libcairod.dll!_cairo_pdf_surface_emit_unscaled_font_subset(_cairo_scaled_font_subset * font_subset=0x0012f684, void * closure=0x00436fe0) Line 3722 + 0xd bytes C<br> libcairod.dll!_cairo_sub_font_collect(void * entry=0x0043af78, void * closure=0x0012f7d0) Line 578 + 0x15 bytes C<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>> libcairod.dll!cairo_surface_destroy(_cairo_surface * surface=0x00433998) Line 435 + 0x9 bytes C<br> hellocairo.exe!main(int argc=2, char * * argv=0x00436f58) Line 50 + 0xc bytes C<br>
hellocairo.exe!__tmainCRTStartup() Line 597 + 0x19 bytes C<br> hellocairo.exe!mainCRTStartup() Line 414 C<br> kernel32.dll!7c817077() <br><br>Thanks..<br><br><br><br><br><div class="gmail_quote">2009/4/24 Gerdus van Zyl <span dir="ltr"><<a href="mailto:gerdusvanzyl@gmail.com">gerdusvanzyl@gmail.com</a>></span><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>
<div class="im"> cairo_surface_destroy(surface);<br>
cairo_destroy(cr);<br>
<br>
</div>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>
<div><div></div><div class="h5"><br>
<br>
On Fri, Apr 24, 2009 at 4:17 PM, Darren Gallagher <<a href="mailto:dazzag@gmail.com">dazzag@gmail.com</a>> wrote:<br>
> 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 <cairo.h><br>
> #include <cairo-pdf.h><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 ("hellocairo.pdf" , 504, 648);<br>
> cr = cairo_create (surface);<br>
> cairo_set_source_rgb(cr, 0, 0, 0);<br>
> cairo_select_font_face (cr, "serif", 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, "Hello, Cairo!");<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>
>> hellocairo.exe!main(int argc=2, char * * argv=0x00436f58) Line 49 +<br>
>> 0xc bytes C<br>
> 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>
</div></div>> _______________________________________________<br>
> cairo mailing list<br>
> <a href="mailto:cairo@cairographics.org">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><br>