In your toggle
handler, you set checked
, which causes the toggle
signal to be issued, which calls the handler again ...
#11564 0xb775ba50 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
I did not follow him, but I see how> 11000 frames will lead to segfault.
To answer your other question: I think that the way to save the full full loop would be with g_idle_add()
:
#include <gtk/gtk.h> static void toggle(GtkWidget *check, gpointer data) { g_print("."); } GtkWidget *window, *check; static gboolean toggle_it() { gboolean checked; g_object_get(check, "active", &checked, NULL); g_object_set(check, "active", !checked, NULL); return TRUE; } int main(int argc, char *argv[]) { gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); check = gtk_check_button_new(); g_signal_connect(check, "toggled", G_CALLBACK(toggle), NULL); gtk_container_add(GTK_CONTAINER(window), check); gtk_widget_show_all(window); g_idle_add((GSourceFunc)toggle_it, NULL); gtk_main(); }
source share