Re: Single toggle reference only



On Sat, 2007-10-20 at 17:58 -0500, Yevgen Muntyan wrote:
> Hi there,
> 
> Is there a technical reason why toggle references
> allow only a single user? Namely, why
> 
> " Multiple toggle references may be added to the same
> gobject, however if there are multiple toggle references
> to an object, none of them will ever be notified until all
> but one are removed."
> 
> Why doesn't it emit a notification when reference count
> drops to N instead of 1, where N is number of
> g_object_add_toggle_ref() calls?

Say you have the following scenario:

                                   GTK+ internal reference
                                         || A
                                         \/               
 C# application data => C# proxy <=> [ GObject ]
                                  B      /\
                                         || C
                                         \/
                             java implementation of object
                        
Your suggestion is that the toggle references B and C should be 
notified when the strong reference A is dropped. But then the
reference to the Java object would be converted to a weak
reference and the Java object improperly collected, even though
it is still referenced from the C# application.

The reason for the documented limitation is that I couldn't figure
out how to make it work.

- Owen

Attachment: signature.asc
Description: This is a digitally signed message part



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