Re: signals connection



wait a second :S

this is the prototype for g_free:

	void g_free (gpointer mem);

and this is the `catch all function pointer' GCallback

	void (*GCallback) (void);

so far so good....

but when it comes down to marshalling the signals
stack garbage will be collected as a return values
from `g_free' in consequence stopping signal emmision
(in most cases you wont have `0' sitting on the stack 
at that spot).

I'm not sure if that _completely_ stops the emission
of *that* signal or if it just stops signal emission
of that "stage" (stage 2 or 4).

http://developer.gnome.org/doc/API/2.0/gobject/gobject-Signals.html
(see "Description")

is not clear on that point IMHO.


Anyhow; its just food for thought ;-)

Cheers,
	-Tristan


Evan Martin wrote:
> 
> On Thu, Mar 20, 2003 at 09:54:09AM -0500, Tristan Van Berkom wrote:
> > Hmmm... it seems to mean that the callback will be called like this:
> >
> > c_handler(G_OBJECT(data), detail, (gpointer) instance);
> >       instead of
> > c_handler(G_OBJECT(instance), detail, (gpointer) data);
> >
> > (I guess where detail is often something like GdkEvent)
> >
> >       I can't think of a practical reason for having such a
> > function but if its there; theres a good chance that its
> > usefull for something ;-)
> 
> To simply destroy "someobject" when "window" is destroyed, you can do
> this:
> 
> g_signal_connect_swapped(G_OBJECT(window), "destroy",
>         G_CALLBACK(g_free), someobject);
> 
> Because of the _swapped, "someobject" will be passed as the first
> argument to g_free() so you can use g_free as a callback directly
> instead of another function which would just call g_free anyway.
> 
> --
>       Evan Martin
> martine cs washington edu
>   http://neugierig.org
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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