[gimp] Bug 768273: Rapid sequence of commands causes crash



commit a93cea0ef5bc810647689ae05ee2fc4760799a39
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Sun Jul 3 18:26:37 2016 +0200

    Bug 768273: Rapid sequence of commands causes crash
    
    do not access progress object after destruction.
    
    silence warnings like:
    
    (gimp-2.8:1): GLib-GObject-WARNING **: gsignal.c:2635: instance '0x17083f0' has no handler with id '56146'
    
    (gimp-2.8:1): Gimp-Plug-In-CRITICAL **: plug_in_icc_profile_apply_rgb: assertion 'progress == NULL || 
GIMP_IS_PROGRESS (progress)' failed

 app/file/file-open.c              |    6 ++++++
 app/plug-in/gimpplugin-progress.c |   16 ++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/app/file/file-open.c b/app/file/file-open.c
index 585616b..45a853a 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -183,6 +183,9 @@ file_open_image (Gimp                *gimp,
   if (! entered_uri)
     entered_uri = g_strdup (path);
 
+  if (progress)
+    g_object_add_weak_pointer (G_OBJECT (progress), (gpointer) &progress);
+
   return_vals =
     gimp_pdb_execute_procedure_by_name (gimp->pdb,
                                         context, progress, error,
@@ -192,6 +195,9 @@ file_open_image (Gimp                *gimp,
                                         G_TYPE_STRING,   entered_uri,
                                         G_TYPE_NONE);
 
+  if (progress)
+    g_object_remove_weak_pointer (G_OBJECT (progress), (gpointer) &progress);
+
   g_free (path);
   g_free (entered_uri);
 
diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c
index 2aaff0e..207d6b8 100644
--- a/app/plug-in/gimpplugin-progress.c
+++ b/app/plug-in/gimpplugin-progress.c
@@ -116,10 +116,15 @@ gimp_plug_in_progress_start (GimpPlugIn  *plug_in,
   if (proc_frame->progress)
     {
       if (! proc_frame->progress_cancel_id)
-        proc_frame->progress_cancel_id =
-          g_signal_connect (proc_frame->progress, "cancel",
-                            G_CALLBACK (gimp_plug_in_progress_cancel_callback),
-                            plug_in);
+        {
+          g_object_add_weak_pointer (G_OBJECT (proc_frame->progress),
+                                     (gpointer) &proc_frame->progress);
+
+          proc_frame->progress_cancel_id =
+            g_signal_connect (proc_frame->progress, "cancel",
+                              G_CALLBACK (gimp_plug_in_progress_cancel_callback),
+                              plug_in);
+        }
 
       if (gimp_progress_is_active (proc_frame->progress))
         {
@@ -151,6 +156,9 @@ gimp_plug_in_progress_end (GimpPlugIn          *plug_in,
           g_signal_handler_disconnect (proc_frame->progress,
                                        proc_frame->progress_cancel_id);
           proc_frame->progress_cancel_id = 0;
+
+          g_object_remove_weak_pointer (G_OBJECT (proc_frame->progress),
+                                        (gpointer) &proc_frame->progress);
         }
 
       if (gimp_plug_in_progress_detach (proc_frame->progress) < 1 &&


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