Re: [gtk-list] GtkObject ref counting [was: resize queuing]




Marius Vollmer <mvo@zagadka.ping.de> writes:

> - a new GtkObject will be created with a reference count of
>   zero. [this is not thread safe, but blends with the established
>   convention.  It would be better to create it with a ref count of
>   one, but that is a *major* API change.  Every Gtk program had to be
>   carefully checked and tweaked.  (Guile/Gtk programs wouldn't notice
>   this, of course, hehe ;-)]

I don't see the thread safety issue here. Every non-C language binding
will presumably increment the refcount as soon as an object is
created, before it is stored in a variable.

Threaded C programs will have to be careful that other threads can't
access an object between the time it is created and the time it is
parented, but this would be dangerous in any circumstance, and since
for the forseeable future there will have to be a mutex around all
GTK calls, pretty easy to ensure.

(That is, programs will have to do
 

  get_gtk_mutex()
   ... gtk calls ...
  release_gtk_mutex()
)

Regards,
                                        Owen



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