Re: [gtk-list] Yes it's broke.




Okey, rewrote Tim's program so I could debug it and understand what was
goin on...

-------------------

#include <gtk/gtk.h>

static void
print_toggle_button_state (GtkWidget *toggle_button,
                           gpointer  user_data)
{
//  g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));

  printf ("togglebutton: active=%d\n", GTK_TOGGLE_BUTTON (toggle_button)->active);
}


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

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  button = gtk_toggle_button_new_with_label ("click me");
  gtk_signal_connect (GTK_OBJECT (button), "clicked", 
                     GTK_SIGNAL_FUNC (print_toggle_button_state), NULL);

  gtk_container_add (GTK_CONTAINER (window), button);

  gtk_widget_show (button);
  gtk_widget_show (window);

  gtk_main ();

  return 0;
}


-----------


Notice the sanity check on the button is commented out, when I leave it in
I get the same segv as in your program.  And when I comment it out both
your program and mine give:


[leeman@method test]$ ./test
togglebutton: active=1
togglebutton: active=1
togglebutton: active=1
togglebutton: active=1
togglebutton: active=1

** ERROR **: sigint caught
[leeman@method test]$ 


And there it is... Soooo, the question is, which of the many differences
between our machines is the culprit for the segv and for the active
problem?

Leeman 
alaric@ct2.nai.net



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