chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Cairo binding


From: Felix Winkelmann
Subject: Re: [Chicken-users] Cairo binding
Date: Thu, 13 Mar 2008 00:12:28 +0100 (CET)

> 
> Ok, cool. I'll probably have something ready in a week or two.

Very good! Looking forward to it.

> 
> A question for the list...
> 
> In the current Cairo egg resources like the cairo context must be 
> explicitly destroyed (with cairo-destroy). Do you think it's a good idea to 
> put these under control of the garbage collector by setting a finalizer to 
> automatically free the resources? Possibly we could leave both options 
> available, removing the finalizer if the resource is explicitly destroyed. We 
> could also have a macro like (with-cairo-context name surface . body)

I recommend manual destruction. The garbage collector is unable to infer whether
C variables still refer to the finalized context.

> 
> Another question - how do you remove a finalizer? I suppose
>   (set-finalizer! obj (lambda (x) (void)))
> might work, assuming it overrides the old one. Is there a better way?

No removing finalizers is not supported yet. You have to check a global
or lexical flag or table, or store a flag indicating finalization 
status directly in the finalized object (or a wrapper object).


cheers,
felix




reply via email to

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