[gimp] Bug 739003 - Crashes in file_save_dialog_response()



commit a0e48ad29e93e2dc259879abeb2dedc9a420b8f6
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jul 14 13:22:06 2015 +0200

    Bug 739003 - Crashes in file_save_dialog_response()
    
    Ref/unref the dialog around saving the image insatead of connecting to
    "destroy" and NULLifying the local dialog variable on destruction,
    which has caused weird crashes on fedora.

 app/dialogs/file-save-dialog.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index dc23396..48c43a6 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -159,7 +159,6 @@ file_save_dialog_response (GtkWidget *save_dialog,
   GFile               *file;
   gchar               *basename;
   GimpPlugInProcedure *save_proc;
-  gulong               handler_id;
 
   if (! dialog->export)
     {
@@ -182,9 +181,7 @@ file_save_dialog_response (GtkWidget *save_dialog,
       return;
     }
 
-  handler_id = g_signal_connect (dialog, "destroy",
-                                 G_CALLBACK (gtk_widget_destroyed),
-                                 &dialog);
+  g_object_ref (dialog);
 
   switch (file_save_dialog_check_file (save_dialog, gimp,
                                        &file, &basename, &save_proc))
@@ -247,9 +244,7 @@ file_save_dialog_response (GtkWidget *save_dialog,
       g_object_unref (file);
       g_free (basename);
 
-      if (dialog)
-        gimp_file_dialog_set_sensitive (dialog, TRUE);
-
+      gimp_file_dialog_set_sensitive (dialog, TRUE);
       break;
 
     case CHECK_URI_SWITCH_DIALOGS:
@@ -261,8 +256,7 @@ file_save_dialog_response (GtkWidget *save_dialog,
       break;
     }
 
-  if (dialog)
-    g_signal_handler_disconnect (dialog, handler_id);
+  g_object_unref (dialog);
 }
 
 /* IMPORTANT: When changing this function, keep


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