Re: [gnome-db] GObject question

On Fri, 2002-06-21 at 15:23, Malerba_Vivien stna dgac fr wrote:
> Hi!
> I've got a question about the GObject's finalization methods.
> I've realized to day that something is wrong with my code because I want
> an object which is being free'd to be able to send signals. Here is what
> happens:
> - I call g_object_unref (object)
> - the _finalize(object) methods gets called on the object and from this
> method I want to send signals., so I call g_signal_emit()
> - g_object_ref (object) is called by the GObject(s implementation but an
> error appears:
> GLib-GObject-CRITICAL **: file gobject.c: line 1292 (g_object_ref):
> assertion `object->ref_count > 0' failed
> Any idea how I could do the same without this error?
> Do I have to override the "dispose" method and send signals from within
> it?
yes, AFAIK, the 'finalize' method is just for freeing memory. That is,
you can't be sure the object will be in a status where you can send
signals and stuff like that. It is just called when the object is being
destroyed, not before it is destroyed.

I'm not sure there is another signal you could use to be notified before
the object is destroyed.


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