[Glade-users] Definition/description of signals....

Christopher Cramer crayc@greatjustice.org
Mon, 15 Nov 2004 13:44:13 -0800


On Tue, Nov 16, 2004 at 09:14:53AM +1300, Worik wrote:
> I am brand new to this mailing list and have joined yet another mailing 
> list in desperation as I can find no place that describes what gtk 
> signals *mean*.

Yeah, the signal docs suck. Best bet is the source code a lot of the time.

> >The "cursor-changed" signal
> >
> >void        user_function                  (GtkTreeView *treeview,
> >                                            gpointer user_data);
> >
> >treeview :    the object which received the signal.
> >user_data :    user data set when the signal handler was connected.
> But *when* is this signal emitted and *why*?

As far as I can tell, it's emitted whenever you select something in
the treeview. Even if you select the same thing that's already selected
("changed", right? go figure). And this includes with the mouse or with
the keyboard.

> My trouble is I have a GtkTreeView I want to detect when a node (a row 
> actually) is selected by the user.  I am using cursor-changed but my app 
> is crashing with a seg fault in a manner which confuses my debugger.

I'm using that signal in my code and it works fine. I can provide the
source code if you're interested.

If it's confusing the debugger, then it's probably not that you're
using the wrong signal. If you're using the wrong signal then it just
will get called at the wrong time, not a segfault. OTOH if you have the
wrong arguments for your signal handler it can segfault, but that part
at least is completely documented.

In any case if the debugger is confused it usually means you overwrote
the stack somewhere. Usually when I get segfaults in a signal handler,
the backtrace works fine.

-- 
Christopher Cramer <crayc@greatjustice.org>
On résiste à l'invasion des armées; on ne résiste pas à l'invasion
des idées. -- Victor Hugo