[gimp] core: move final unref of images from gimp_real_exit to gimp_exit



commit 1e4cbd3232ee6cc5ede1442505071d6d4f9caace
Author: Kristian Rietveld <kris loopnest org>
Date:   Sat Apr 16 13:52:41 2016 +0100

    core: move final unref of images from gimp_real_exit to gimp_exit
    
    We needed to get rid of these images at a later point. This fixes (at
    least) a crash seen on Mac OS X, where the images were being unreffed
    before the last GimpActions (with a reference to the image) were
    unreffed.

 app/core/gimp.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/app/core/gimp.c b/app/core/gimp.c
index 93ecbf1..8f089b9 100644
--- a/app/core/gimp.c
+++ b/app/core/gimp.c
@@ -843,19 +843,9 @@ static gboolean
 gimp_real_exit (Gimp     *gimp,
                 gboolean  force)
 {
-  GList *image_iter;
-
   if (gimp->be_verbose)
     g_print ("EXIT: %s\n", G_STRFUNC);
 
-  /* get rid of images without display */
-  while ((image_iter = gimp_get_image_iter (gimp)))
-    {
-      GimpImage *image = image_iter->data;
-
-      g_object_unref (image);
-    }
-
   gimp_plug_in_manager_exit (gimp->plug_in_manager);
   gimp_modules_unload (gimp);
 
@@ -1210,7 +1200,8 @@ void
 gimp_exit (Gimp     *gimp,
            gboolean  force)
 {
-  gboolean handled;
+  gboolean  handled;
+  GList    *image_iter;
 
   g_return_if_fail (GIMP_IS_GIMP (gimp));
 
@@ -1220,6 +1211,18 @@ gimp_exit (Gimp     *gimp,
   g_signal_emit (gimp, gimp_signals[EXIT], 0,
                  force ? TRUE : FALSE,
                  &handled);
+
+  /* Get rid of images without display. We do this *after* handling the
+   * usual exit callbacks, because the things that are torn down there
+   * might have references to these images (for instance GimpActions
+   * in the UI manager).
+   */
+  while ((image_iter = gimp_get_image_iter (gimp)))
+    {
+      GimpImage *image = image_iter->data;
+
+      g_object_unref (image);
+    }
 }
 
 GList *


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