[gtk+] testlevelbar: don't segfault when quitting testlevelbar
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] testlevelbar: don't segfault when quitting testlevelbar
- Date: Mon, 27 Oct 2014 11:06:07 +0000 (UTC)
commit 0555ef20a45e15c83f2698f276d105d686ea5c9f
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Oct 24 14:53:26 2014 -0700
testlevelbar: don't segfault when quitting testlevelbar
Quit the mainloop when the window is closed.
https://bugzilla.gnome.org/show_bug.cgi?id=707695
tests/testlevelbar.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/tests/testlevelbar.c b/tests/testlevelbar.c
index 51b4af6..41dce8b 100644
--- a/tests/testlevelbar.c
+++ b/tests/testlevelbar.c
@@ -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 ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]