[gnome-flashback] polkit: fix crash closing dialog



commit 7357dad1701f0e780de436f409137163cba7d15c
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Jun 21 14:38:58 2017 +0300

    polkit: fix crash closing dialog

 .../libpolkit/flashback-polkit-dialog.c            |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gnome-flashback/libpolkit/flashback-polkit-dialog.c 
b/gnome-flashback/libpolkit/flashback-polkit-dialog.c
index 34fde6a..56ce5d8 100644
--- a/gnome-flashback/libpolkit/flashback-polkit-dialog.c
+++ b/gnome-flashback/libpolkit/flashback-polkit-dialog.c
@@ -898,6 +898,20 @@ flashback_polkit_dialog_close (FlashbackPolkitDialog *dialog,
   gtk_window_close (GTK_WINDOW (dialog));
 }
 
+static gboolean
+delete_event_cb (FlashbackPolkitDialog *dialog,
+                 GdkEvent              *event,
+                 gpointer               user_data)
+{
+  if (!dialog->is_running)
+    return FALSE;
+
+  dialog->response = GTK_RESPONSE_DELETE_EVENT;
+  gtk_main_quit ();
+
+  return TRUE;
+}
+
 static void
 flashback_polkit_dialog_init (FlashbackPolkitDialog *dialog)
 {
@@ -914,6 +928,10 @@ flashback_polkit_dialog_init (FlashbackPolkitDialog *dialog)
   g_signal_connect (dialog, "close",
                     G_CALLBACK (flashback_polkit_dialog_close),
                     NULL);
+
+  g_signal_connect (dialog, "delete-event",
+                    G_CALLBACK (delete_event_cb),
+                    NULL);
 }
 
 /**


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