[gimp/gimp-2-8] Bug 768273: Rapid sequence of commands causes crash



commit 3e33f03e209b6da0da4886847b8e2721ff5a4ab5
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
    
    (cherry picked from commit a93cea0ef5bc810647689ae05ee2fc4760799a39)
    
     Conflicts:
        app/file/file-open.c

 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 3d10c28..1e2b17f 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -154,6 +154,9 @@ file_open_image (Gimp                *gimp,
       return NULL;
     }
 
+  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,
@@ -163,6 +166,9 @@ file_open_image (Gimp                *gimp,
                                         G_TYPE_STRING,   entered_filename,
                                         G_TYPE_NONE);
 
+  if (progress)
+    g_object_remove_weak_pointer (G_OBJECT (progress), (gpointer) &progress);
+
   g_free (filename);
 
   *status = g_value_get_enum (&return_vals->values[0]);
diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c
index 9c06937..de6a6f9 100644
--- a/app/plug-in/gimpplugin-progress.c
+++ b/app/plug-in/gimpplugin-progress.c
@@ -115,10 +115,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]