On 12/27/06, Samuel Cormier-Iijima <[EMAIL PROTECTED]> wrote: > In a single threaded app, I don't think it would matter too much.
That is, if you're not calling other callbacks within that function of course :-) > However, if you're using multiple threads that handle this object, > unless you know exactly what's happening it's probably a good idea. I > could be wrong about this though, can anyone back this up? (at least, > that's what I do with gobjects) > > Samuel > > On 12/27/06, Philip Kovacs <[EMAIL PROTECTED]> wrote: > > Is it good practice always to ref count GObject's passed into functions -- > > even if you know for certain that the primary reference is in your control, > > i.e. the first reference cannot be unref'd by surprise? > > > > For large, complex objects with many api's, most of which are private, > > I find that all this reference counting appears to be useless since I > > have the creation reference safely in my control. > > > > In other words: > > > > void foo (GObject *obj) > > { > > g_object_ref (obj); <-- redundant? > > > > /* do something */ > > > > g_object_unef (obj); <-- redundant? > > } > > > > int my_private_function () > > { > > GObject *obj = create_my_object (...); > > > > foo (obj); > > > > g_object_unref (obj); > > } > > > > > > > > > > > > _______________________________________________ > > gtk-app-devel-list mailing list > > gtk-app-devel-list@gnome.org > > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > > > > > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list