Re: [gtk-list] Re: gtk_signal_connect_interp()
- From: Tim Janik <timj gimp org>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: gtk_signal_connect_interp()
- Date: Tue, 10 Feb 1998 21:40:37 +0100 (CET)
On Tue, 10 Feb 1998, Marc Ewing wrote:
> Owen Taylor <owt1@cornell.edu> writes:
> > > if I need to have the
> > > data portion of a signal handler freed or taken care of in some
> > > way when the handler is removed, I need to do something like:
> > >
> > > gtk_signal_connect_interp(GTK_OBJECT(item), "expand",
> > > expand_tree, s, g_free, FALSE);
> > >
> > > (where the data, s, is the result of a g_strdup()). Is this
> > > correct? Does gtk_signal_connect_interp() do more than that?
> > > Is there some other way to accomplish what I need?
> >
> > Hmmm. Right now, this won't work, because gtk_signal_connect_interp
> > expects the function to be a special marshall function instead of an
> > everyday garden-variety signal handler. I discussed solutions to this
> > problem with Marius a few months ago, but nothing came of it.
> >
> > For now, the right thing to do is to free your data in the "destroy"
> > callback (and if you gtk_signal_disconnect anywhere explicitly, also
> > free it there).
>
> Is there a "legal" way to obtain the data pointer for a signal
> handler during the destroy so I don't have to keep a table of
> those data pointers around anywhere?
hm, as long as you have the handler id (returned from gtk_signal_connect),
it wouldn't present much of a problem to provide a function
gpointer gtk_signal_get_data (guint anid);
>
> It seems to me that this would be a generally useful (optional)
> feature of signal handlers. Often times I find myself wanting
> to stick some data in the data bit, and then forget about it
> forever. Passing a function as an argument to gtk_signal_connect()
> (or something variant) that can handle the data cleanup would
> make this easy to program.
>
> -Marc
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]