[cairo] Crash in 1.8.6 win32 with PDF surface -FIXED
Darren Gallagher
dazzag at gmail.com
Mon Apr 27 03:14:59 PDT 2009
Hi,
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.
Thanks for your suggestions.
Daz
2009/4/27 Darren Gallagher <dazzag at gmail.com>
> Hi,
>
> Just tried adding in the call to cairo_surface_finish(). It still
> crashes. Code now as follows:
>
> cairo_surface_t *surface;
> cairo_t *cr;
>
> surface = cairo_pdf_surface_create ("hellocairo.pdf" , 504, 648);
> cr = cairo_create (surface);
> cairo_set_source_rgb(cr, 0, 0, 0);
> cairo_select_font_face (cr, "serif", CAIRO_FONT_SLANT_NORMAL,
> CAIRO_FONT_WEIGHT_NORMAL);
> cairo_set_font_size (cr, 40.0);
> cairo_move_to(cr, 10.0, 50.0);
> cairo_show_text(cr, "Hello, Cairo!");
> //drawDashLine(cr);
> cairo_show_page(cr);
> cairo_surface_finish(surface);
> cairo_surface_destroy(surface);
> cairo_destroy(cr);
>
> Stack trace:
>
> ntdll.dll!7c90120e()
> [Frames below may be incorrect and/or missing, no symbols loaded for
> ntdll.dll]
> ntdll.dll!7c96e139()
> ntdll.dll!7c96e576()
> ntdll.dll!7c9622e8()
> kernel32.dll!7c85f9a7()
> msvcr80d.dll!_CrtIsValidHeapPointer(const void *
> pUserData=0x00955c48) Line 2072 C++
> msvcr80d.dll!_free_dbg_nolock(void * pUserData=0x00955c48, int
> nBlockUse=1) Line 1279 + 0x9 bytes C++
> msvcr80d.dll!_free_dbg(void * pUserData=0x00955c48, int nBlockUse=1)
> Line 1220 + 0xd bytes C++
> msvcr80d.dll!free(void * pUserData=0x00955c48) Line 1178 + 0xb
> bytes C++
> libcairod.dll!_cairo_truetype_subset_fini(_cairo_truetype_subset *
> subset=0x0012f4c0) Line 1171 + 0xe bytes C
>
> 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
>
> libcairod.dll!_cairo_pdf_surface_emit_unscaled_font_subset(_cairo_scaled_font_subset
> * font_subset=0x0012f75c, void * closure=0x00436fe0) Line 3722 + 0xd
> bytes C
> libcairod.dll!_cairo_sub_font_collect(void * entry=0x0043af78, void *
> closure=0x0012f8a8) Line 578 + 0x15 bytes C
>
> 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
>
> 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
> libcairod.dll!_cairo_pdf_surface_emit_font_subsets(_cairo_pdf_surface
> * surface=0x00436fe0) Line 3774 + 0x18 bytes C
> libcairod.dll!_cairo_pdf_surface_finish(void *
> abstract_surface=0x00436fe0) Line 1195 + 0x9 bytes C
> libcairod.dll!cairo_surface_finish(_cairo_surface *
> surface=0x00436fe0) Line 530 + 0x10 bytes C
> libcairod.dll!_cairo_paginated_surface_finish(void *
> abstract_surface=0x00433998) Line 172 + 0xf bytes C
> libcairod.dll!cairo_surface_finish(_cairo_surface *
> surface=0x00433998) Line 530 + 0x10 bytes C
> > hellocairo.exe!main(int argc=2, char * * argv=0x00436f58) Line 48 +
> 0xc bytes C
> hellocairo.exe!__tmainCRTStartup() Line 597 + 0x19 bytes C
> hellocairo.exe!mainCRTStartup() Line 414 C
> kernel32.dll!7c817077()
>
> Thanks
>
> 2009/4/24 Behdad Esfahbod <behdad at behdad.org>
>
>> On 04/24/2009 11:59 AM, Gerdus van Zyl wrote:
>>
>> Try reversing the lines:
>>> cairo_surface_destroy(surface);
>>> cairo_destroy(cr);
>>>
>>> destroying the surface before the context looks suspect. and when
>>> working with PDF you might want a cairo_surface_finish before
>>> destroying.
>>>
>>
>> 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's the problem.
>>
>> behdad
>>
>>
>> On Fri, Apr 24, 2009 at 4:17 PM, Darren Gallagher<dazzag at gmail.com>
>>> wrote:
>>>
>>>> Using 1.8.6 on windows (with pixman 0.15.2). Built using instructions
>>>> here:
>>>>
>>>> http://www.williamcyap.com/software/cairo-lib/compiling-cairo-for-windows.xhtml
>>>>
>>>> produces a crash witin cairo_destroy() somewhere.
>>>>
>>>> The code is as follows:
>>>>
>>>> #include<cairo.h>
>>>> #include<cairo-pdf.h>
>>>>
>>>> int main (int argc, char *argv[])
>>>> {
>>>> cairo_surface_t *surface;
>>>> cairo_t *cr;
>>>>
>>>> surface = cairo_pdf_surface_create ("hellocairo.pdf" , 504, 648);
>>>> cr = cairo_create (surface);
>>>> cairo_set_source_rgb(cr, 0, 0, 0);
>>>> cairo_select_font_face (cr, "serif", CAIRO_FONT_SLANT_NORMAL,
>>>> CAIRO_FONT_WEIGHT_NORMAL);
>>>> cairo_set_font_size (cr, 40.0);
>>>> cairo_move_to(cr, 10.0, 50.0);
>>>> cairo_show_text(cr, "Hello, Cairo!");
>>>> cairo_show_page(cr);
>>>> cairo_surface_destroy(surface);
>>>> cairo_destroy(cr);
>>>>
>>>> return 0;
>>>> }
>>>>
>>>> the stack is as follows:
>>>>
>>>> ntdll.dll!7c90120e()
>>>> [Frames below may be incorrect and/or missing, no symbols loaded
>>>> for
>>>> ntdll.dll]
>>>> ntdll.dll!7c96c201()
>>>> ntdll.dll!7c96c63e()
>>>> ntdll.dll!7c9603b0()
>>>> kernel32.dll!7c85f8d7()
>>>> msvcr80d.dll!_CrtIsValidHeapPointer(const void *
>>>> pUserData=0x00955c50)
>>>> Line 2072 C++
>>>> msvcr80d.dll!_free_dbg_nolock(void * pUserData=0x00955c50, int
>>>> nBlockUse=1) Line 1279 + 0x9 bytes C++
>>>> msvcr80d.dll!_free_dbg(void * pUserData=0x00955c50, int
>>>> nBlockUse=1)
>>>> Line 1220 + 0xd bytes C++
>>>> msvcr80d.dll!free(void * pUserData=0x00955c50) Line 1178 + 0xb
>>>> bytes C++
>>>> libcairod.dll!_cairo_truetype_subset_fini(_cairo_truetype_subset *
>>>> subset=0x0012f22c) Line 1171 + 0xe bytes C
>>>>
>>>>
>>>> libcairod.dll!_cairo_pdf_surface_emit_truetype_font_subset(_cairo_pdf_surface
>>>> * surface=0x00436fe0, _cairo_scaled_font_subset *
>>>> font_subset=0x0012f4c8)
>>>> Line 3451 + 0xc bytes C
>>>>
>>>>
>>>> libcairod.dll!_cairo_pdf_surface_emit_unscaled_font_subset(_cairo_scaled_font_subset
>>>> * font_subset=0x0012f4c8, void * closure=0x00436fe0) Line 3722 + 0xd
>>>> bytes C
>>>> libcairod.dll!_cairo_sub_font_collect(void * entry=0x0043af78, void
>>>> *
>>>> closure=0x0012f614) Line 578 + 0x15 bytes C
>>>>
>>>>
>>>> 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
>>>>
>>>>
>>>> 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
>>>>
>>>> libcairod.dll!_cairo_pdf_surface_emit_font_subsets(_cairo_pdf_surface *
>>>> surface=0x00436fe0) Line 3774 + 0x18 bytes C
>>>> libcairod.dll!_cairo_pdf_surface_finish(void *
>>>> abstract_surface=0x00436fe0) Line 1195 + 0x9 bytes C
>>>> libcairod.dll!cairo_surface_finish(_cairo_surface *
>>>> surface=0x00436fe0) Line 530 + 0x10 bytes C
>>>> libcairod.dll!_cairo_paginated_surface_finish(void *
>>>> abstract_surface=0x00433998) Line 172 + 0xf bytes C
>>>> libcairod.dll!cairo_surface_finish(_cairo_surface *
>>>> surface=0x00433998) Line 530 + 0x10 bytes C
>>>> libcairod.dll!cairo_surface_destroy(_cairo_surface *
>>>> surface=0x00433998) Line 435 + 0x9 bytes C
>>>> libcairod.dll!_cairo_gstate_fini(_cairo_gstate * gstate=0x00438a30)
>>>> Line 205 + 0xf bytes C
>>>> libcairod.dll!cairo_destroy(_cairo * cr=0x00438a10) Line 228 + 0xc
>>>> bytes C
>>>>
>>>>> hellocairo.exe!main(int argc=2, char * * argv=0x00436f58) Line 49
>>>>> +
>>>>> 0xc bytes C
>>>>>
>>>> hellocairo.exe!__tmainCRTStartup() Line 597 + 0x19 bytes C
>>>> hellocairo.exe!mainCRTStartup() Line 414 C
>>>> kernel32.dll!7c817067()
>>>>
>>>> Any help appreciated.
>>>>
>>>> Thanks
>>>>
>>>> Daz
>>>>
>>>>
>>>> _______________________________________________
>>>> cairo mailing list
>>>> cairo at cairographics.org
>>>> http://lists.cairographics.org/mailman/listinfo/cairo
>>>>
>>>> _______________________________________________
>>> cairo mailing list
>>> cairo at cairographics.org
>>> http://lists.cairographics.org/mailman/listinfo/cairo
>>>
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20090427/2111f939/attachment.html
More information about the cairo
mailing list