[Glade-users] pbm with lookup_widget

Chris Ellec cae@oco.net
Mon, 13 Aug 2001 20:17:53 +0000


Damon Chaplin wrote:
> 
> 
> If you are using libglade you usually use another function to
> get pointers to widgets, something like glade_xml_get_widget().
> 
> Can you send a stack trace?
> 
> Damon


here is part of the program:

-----
void print_message(char *my_message,int my_color)
{

GdkColor color_red={ 0xffff,0xffff, 0x0, 0x0 };	// red is 255,0,0

if (GTK_WIDGET_VISIBLE(test_window)) {	// make sure the window is
available
	if (my_color) {
	  gtk_text_insert (GTK_TEXT (lookup_widget(test_window,"Test_report")),
   		 NULL, &color_red, NULL, my_message, strlen(my_message));
	}	 
	else	{
	  printf("we're here\n");

	  if (test_window)
	  	printf("test_window ok\n");
	  else
	  	printf("test_window null\n");
		
	  if (  (lookup_widget(test_window,"Test_report")) )	// line 103
	  	printf("lookup ok\n");
	  else
		printf("error in lookup\n");

	  gtk_text_insert (GTK_TEXT (lookup_widget(test_window,"Test_report")),
   		 NULL, NULL, NULL, my_message, strlen(my_message));
 	  printf("we're there\n");

	}

  }
}
-------

Originally I only had the gtk_text_insert, but that crashed, so I added
the rest to isolate the problem.

I am not using libglade for that program, it's just the only thing I can
remember changing lately that I though could have something to do with
it.



> we're here
> test_window ok
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x1460280 in ?? ()
> (gdb) bt
> #0  0x1460280 in ?? ()
> #1  0x80645ae in print_message (
>     my_message=0x811c0c8 "Testing connectors on adapter: AG001-02 \n", 
>     my_color=0) at util.c:103
> #2  0x8055b65 in test_wired () at master.c:744
> #3  0x40181139 in g_idle_dispatch ()
> #4  0x40180186 in g_main_dispatch ()
> #5  0x40180751 in g_main_iterate ()
> #6  0x401808f1 in g_main_run ()
> #7  0x400a45b9 in gtk_main ()
> #8  0x8054bdd in main (argc=1, argv=0xbffffc64) at main.c:115
> #9  0x4028a1eb in __libc_start_main (main=0x8054a70 <main>, argc=1, 
>     argv=0xbffffc64, init=0x8053d7c <_init>, fini=0x80a018c <_fini>, 
>     rtld_fini=0x4000a610 <_dl_fini>, stack_end=0xbffffc5c)
>     at ../sysdeps/generic/libc-start.c:90
> (gdb) quit



Thanks,

Chris.