On Mon, 2008-08-11 at 14:34 -0700, Noah Gibbs wrote:

>   It would be easy enough to write one or more functions to grab these
> items from a ClutterScript object.  Anybody know a reason why the
> interface shouldn't have such functions?

I've been meaning to ask about having a function to do this as well
because it would help make the Ruby bindings more robust.

Because Ruby has a mark-sweep garbage collector, the Ruby GObject
bindings do a surprising thing which is to try to mark every GObject
that could potentially be seen by Ruby at every run of the GC. So for
example, for GTK it iterates over every toplevel window and descends all
of the children to mark all of the widgets and even marks the value of
every object-type property of every object.

So to hook into this the mark function for a ClutterScript object you
would need to be able to mark all of the contained objects. Otherwise
you could retrieve an object from the script, connect a signal handler
to it with a closure in Ruby and then let Ruby forget about the object.
When the garbage collector later runs, it would it reap Ruby's data for
the object including the closure. When the signal is fired it would
probably just crash.

Yes that's probably not the right way for the Ruby GObject bindings to
work, but that's unfortunately how it's done.

- Neil

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to