[Top][All Lists]

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

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

From: Christian Kellermann
Subject: [Chicken-users] [Patch] Cairo's ffi may be wrong...
Date: Sat, 8 Oct 2011 23:15:19 +0200
User-agent: Mutt/1.5.21 (2010-09-15)


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.



Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 

Attachment: cairo-ffi-scheme-pointer.diff
Description: Text document

reply via email to

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