[gtk+/wip/baedert/gtk-widget-destroy] gtk-demo: Don't destroy window after delete response



commit b5ec55b8698e52a543d02c76df95e30a3a8eccae
Author: Timm Bäder <mail baedert org>
Date:   Sat Oct 7 09:03:28 2017 +0200

    gtk-demo: Don't destroy window after delete response
    
    GTK_RESPONSE_DELETE_EVENT means that gtk will call gtk_window_destroy
    itself, so we can't do it a second time.

 demos/gtk-demo/expander.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/demos/gtk-demo/expander.c b/demos/gtk-demo/expander.c
index 6f1d149..b872ca5 100644
--- a/demos/gtk-demo/expander.c
+++ b/demos/gtk-demo/expander.c
@@ -15,8 +15,11 @@ static GtkWidget *window = NULL;
 static void
 response_cb (GtkDialog *dialog, gint response_id)
 {
-  gtk_window_destroy (GTK_WINDOW (window));
-  window = NULL;
+  if (response_id != GTK_RESPONSE_DELETE_EVENT)
+    {
+      gtk_window_destroy (GTK_WINDOW (window));
+      window = NULL;
+    }
 }
 
 static void


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