<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Thanks so much Chris for confirming.<br>With that knowledge I managed to reproduce and eliminate the bug.<br>There was a thread trying to read this surface stuff when it *really* shouldn't :)<br><br>I'm having great fun with cairo doing animations and stuff. Hopefully I'll be able to post a video of my app at some point :)<br><br>Best Regards<br>Julien<br><br>> Date: Sat, 5 Dec 2009 08:50:18 +0000<br>> To: julien_bramary@msn.com; cairo@cairographics.org<br>> Subject: Re: [cairo] Can an expert look at this stack trace?<br>> From: chris@chris-wilson.co.uk<br>> <br>> On Sat, 5 Dec 2009 06:06:51 +0100, Julien Bramary <julien_bramary@msn.com> wrote:<br>> > <br>> > Hello all, this is my first post to this list.<br>> <br>> Welcome, we hope you are having fun using Cairo, and this does not mar the<br>> experience!<br>> <br>> > I am writing a threaded cairo application and I need help understanding a rare-ish bug.<br>> > I'm still using cairo 1.8.8 but considering an upgrade to get the nice profiling tools.<br>> > <br>> > Every so often I get the following crash:<br>> > cairo-board: cairo-surface.c:406: cairo_surface_reference: Assertion `((*&(&surface->ref_count)->ref_count) > 0)' failed.<br>> > /usr/lib/libcairo.so.2(cairo_pattern_create_for_surface+0x7d) [0x7f2e24966a6d]<br>> > /usr/lib/libcairo.so.2(cairo_set_source_surface+0x46) [0x7f2e249525b6]<br>> > ./cairo-board [0x40f591]<br>> > <br>> > If understand correctly my application is calling set_source_surface on an invalid surface?<br>> > Does it mean the surface was destroyed? This is very possible as the code is quite convoluted.<br>> <br>> Yes, this means that cairo_surface_reference() has been called on a<br>> surface that has already been freed. In this particular case you are<br>> trying to use a source surface that has already been destroyed.<br>> <br>> > The rarity of the crash (less than 1/100) makes me think it might be a timing issue with a thread destroying the surface while another one tries to read it with cairo_set_source_surface but I can't see where as everything should be locked...<br>> > I'd like to know if an expert can confirm.<br>> <br>> Ah the spectre of threads. If you even suspect you have a race here, you<br>> do. The thread using the surface as a source must own a reference to the<br>> surface, so there should be no doubt as to the validity of that surface<br>> and hence no race. So either you've violated that principle or you have<br>> a double-free somewhere in your code.<br>> -ickle<br>> <br>> -- <br>> Chris Wilson, Intel Open Source Technology Centre<br>                                            <br /><hr />Windows Live: Make it easier for your friends to see <a href='http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009' target='_new'>what you’re up to on Facebook.</a></body>
</html>