chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] [Patch] Cairo's ffi may be wrong...


From: Markus Klotzbuecher
Subject: Re: [Chicken-users] [Patch] Cairo's ffi may be wrong...
Date: Mon, 10 Oct 2011 09:10:35 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Christian,

On Sat, Oct 08, 2011 at 11:15:19PM +0200, Christian Kellermann wrote:
> 
> I have toyed around with the cairo egg and experimented with text
> flow given a box with a specified size. In the result of this I
> have been calling the cairo-text-extents procedures a lot which
> resulted in either segmentation faults or out of memory panics.
> 
> This procedure creates a u8-vector that it passes to the cairo C
> function which treats it as a struct and fills it's slots. The
> casting is done with a typed c-pointer.
> 
> Jim suggested on #chicken that cairo's use of c-pointers pointing
> to scheme objects may be the culprit here as we don't point to the
> data itself but to the non immediate scheme object as a whole.
> 
> So the attached patch uses scheme pointers instead of the c-pointers
> for these structures which makes additional casting necessary for
> the accessors. Maybe adding a typed variant of scheme-pointer would
> make sense?
> 
> It also uses blobs for the storage space instead of u8-vectors since
> the manual (and Jim) warns against its use wiht a scheme-pointer.
> (As much as I understood it, I may be completely off track as well).
> 
> Thanks to Jim for the suggestions, errors in the patch are all mine.
> 
> I have posted this to chicken-users, because I would like to know
> whether someone else besides me uses this egg and has seen similar
> strange things *and* is willing to test this patch before I am going
> to apply it to trunk (if it is correct at all!).
> 
> So please speak up if you do use cairo and let me hear your experiences
> with it.

I'm planning to use cairo for a small visualization tool, but so far
I've not gone beyond some dummy test. I have not seen any problems so
far, but also didn't use cairo-text-extents yet.

In any case I can confirm your patch did not break my dummy program!

Best regards
Markus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]