forked from AuroraMiddleware/gtk
testlevelbar: don't segfault when quitting testlevelbar
Quit the mainloop when the window is closed. https://bugzilla.gnome.org/show_bug.cgi?id=707695
This commit is contained in:
parent
3a2bf9d878
commit
0555ef20a4
@ -55,6 +55,15 @@ increase_level (gpointer data)
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
window_delete_event (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer _data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@ -72,6 +81,9 @@ main (int argc, char *argv[])
|
||||
gtk_container_add (GTK_CONTAINER (window), bar);
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
g_signal_connect (window, "delete-event",
|
||||
G_CALLBACK (window_delete_event), NULL);
|
||||
|
||||
g_timeout_add (100, increase_level, bar);
|
||||
gtk_main ();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user