GObject ref counting
- From: Philip Kovacs <kovacsp3 comcast net>
- To: gtk-app-devel-list gnome org
- Subject: GObject ref counting
- Date: Wed, 27 Dec 2006 15:06:46 -0500
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]