[Pkg-privacy-commits] [nautilus-wipe] 37/224: Release our parent window pointer when it gets destroyed

Ulrike Uhlig u-guest at moszumanska.debian.org
Thu Jul 7 19:45:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to branch master
in repository nautilus-wipe.

commit 5a875ffe1dbab9e5d44e85a470a75c8bd8af4c58
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Sun Feb 21 02:32:31 2010 +0100

    Release our parent window pointer when it gets destroyed
    
    Properly release our window pointer on its ::destroy signal to avoid
    problems if the window was destroyed during the operation, as we would
    then have an invalid window pointer.
    Fixes displaying of the result dialog after the operation if the parent
    Nautilus window was closed.
---
 nautilus-srm/operation-manager.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/nautilus-srm/operation-manager.c b/nautilus-srm/operation-manager.c
index a981903..25acc4b 100644
--- a/nautilus-srm/operation-manager.c
+++ b/nautilus-srm/operation-manager.c
@@ -102,6 +102,7 @@ display_dialog (GtkWindow       *parent,
 struct NautilusSrmOperationData
 {
   GtkWindow                  *window;
+  gulong                      window_destroy_hid;
   NautilusSrmProgressDialog  *progress_dialog;
   gchar                      *failed_primary_text;
   gchar                      *success_primary_text;
@@ -113,12 +114,26 @@ struct NautilusSrmOperationData
 static void
 free_opdata (struct NautilusSrmOperationData *opdata)
 {
+  if (opdata->window_destroy_hid) {
+    g_signal_handler_disconnect (opdata->window, opdata->window_destroy_hid);
+  }
   g_free (opdata->failed_primary_text);
   g_free (opdata->success_primary_text);
   g_free (opdata->success_secondary_text);
   g_slice_free1 (sizeof *opdata, opdata);
 }
 
+/* if the parent window get destroyed, we honor gently the thing and leave it
+ * to the death. doing this is useful not to have a bad window pointer later */
+static void
+opdata_window_destroy_handler (GtkObject                       *obj,
+                               struct NautilusSrmOperationData *opdata)
+{
+  g_signal_handler_disconnect (opdata->window, opdata->window_destroy_hid);
+  opdata->window_destroy_hid = 0;
+  opdata->window = NULL;
+}
+
 /* Displays an operation's error */
 static void
 display_operation_error (struct NautilusSrmOperationData *opdata,
@@ -202,6 +217,8 @@ nautilus_srm_operation_manager_run (GtkWindow                *parent,
     
     opdata = g_slice_alloc (sizeof *opdata);
     opdata->window = parent;
+    opdata->window_destroy_hid = g_signal_connect (opdata->window, "destroy",
+                                                   G_CALLBACK (opdata_window_destroy_handler), opdata);
     opdata->progress_dialog = NAUTILUS_SRM_PROGRESS_DIALOG (nautilus_srm_progress_dialog_new (opdata->window, 0,
                                                                                               progress_dialog_text));
     opdata->failed_primary_text = g_strdup (failed_primary_text);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/nautilus-wipe.git



More information about the Pkg-privacy-commits mailing list