Re: Proposal: gtk_object to emmit reference changed signals



sopwith@redhat.com (Elliot Lee) writes:

[...]
> Trying to mirror refcounts between different objects didn't work very well
> for the ObjC bindings when I was doing them. I'm not quite clear on how the
> Eiffel GC works - does it allow you to have an is_object_in_use() method
> called? The best way seems to be to just have an Eiffel object with no
> explicit refcounts on a GtkObject, and then when the 'destroy' signal on the
> GtkObject fires, you mark your Eiffel object as being no longer in use. You
> also have a way to turn a GtkObject into an Eiffel object
> (gtk_object_[gs]et_data() :).

I have used that in pygtk (python language binding) to permanently
associate python class instances with gtk objects. The current way is
to always create a new instance (e.g. for signal handlers), so the
state of the python instance is not preserved. It works quite well,
though there is one problem: it doesn't work for destroy signal
handlers, because the handler to clean up the reference on destroy is
installed first. My current workaround is to remove and reinstall this 
signal handler when another handler for destroy is to be installed.

Anyone a better idea?

ciao
Andreas

PS: python objects aren't moved around, so its only storing and using
    a simple C pointer.



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