[Glade-users] Accessing a specific widget

Damon Chaplin damon@ximian.com
Mon, 12 Feb 2001 12:11:38 +0000


RJ Krawchuk wrote:
> 
> Hi,
> 
> Thank you for your help on a previous post. I realize that in order to
> access a widget, you need to use the lookup_widget function, I understand
> how I am supposed to access it this way when I have a set such as ths:
> Window
>           |_ CList      - CList = lookup_widget(Window, "CList"); Assuming the
> variables have been initialized, this works (Thanks to Andrae Muys)
> 
> However, in a new project I have set up it fails. I do not get any errors
> but it crashes with a segmentation directly related to the lookup_widget
> function. The widget tree looks like this:
> winViewLogs
>              |_+dock1
>              |_+nbviewlogs
>                         |_scrolledwindow1
>                                          |_cl_bootlog
>         No matter where I try the lookup_widget function to get a return poiinter
> to any of the above widgets, I keep receiving a segmentation fault. I have
> included the code as well, just to make sure if I was missing something. I
> was able to isolate it to the lookup_widget function.

You have winViewLogs declared as a global:

GtkWidget *winViewLogs;

and then in main():

int
main (int argc, char *argv[])
{
	GtkWidget *winViewLogs;


So the global variable is not being set at all.

Get rid of the declaration in main() and it should work better.

Damon