[pygtk] is GObject initialized?
Johan Dahlin
jdahlin at async.com.br
Sun Dec 3 09:28:30 WST 2006
> Is there a non-hackish way to find if GObject is initialized or not?
> It seems non-initialized objects have zero hash, while initialized
> have non-zero, but it is probably a hack to depend on it...
>
Using the hash is fine.
It's currently implemented like this:
static long
pygobject_hash(PyGObject *self)
{
return (long)self->obj;
}
self->obj is NULL if the object isn't initialized and will return 0.
If it's initialized, self->obj will return the memory address of the
GObject pointer.
This code is unlikely to go away and you can safely depend on it.
Johan
More information about the pygtk
mailing list