chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Cairo binding


From: John Cowan
Subject: Re: [Chicken-users] Cairo binding
Date: Tue, 11 Mar 2008 16:04:39 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

Luke McCarthy scripsit:

> 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?

Yes, emphatically.

> Possibly we could leave both options 
> available, removing the finalizer if the resource is explicitly destroyed.  

Unless cairo resources are very scarce, I'd rather have automated
destruction only, leaving cairo-destroy as a no-op.  Manual destruction
generally goes according to the Book of Common Prayer: "we have left
undone those things which we ought to have done; and we have done those
things which we ought not to have done; and there is no health in us."

> We could also have a macro like (with-cairo-context name surface . body)

Good.  Remember to use dynamic-wind.

> 
> 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?

There is a low-level routine C_do_unregister_finalizer, but there doesn't
seem to be any way to invoke it from Scheme; I don't know why.

-- 
                Si hoc legere scis, nimium eruditionis habes.




reply via email to

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