[gimp] libgimp: gimp_plug_in_destroy_proxies() never checked for too much refs



commit 747fce7260c251d66ca734c0cfb5b3d291c135cd
Author: Michael Natterer <mitch gimp org>
Date:   Thu Sep 5 12:18:58 2019 +0200

    libgimp: gimp_plug_in_destroy_proxies() never checked for too much refs
    
    because we were simply destroying the proxy hashes when the last
    procedure is done. Now we run gimp_plug_in_destroy_proxies() with the
    right flag from gimp_plug_in_pop_procedure() before destroying the
    hashes and get the proper debug warnings.

 libgimp/gimpplugin.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/libgimp/gimpplugin.c b/libgimp/gimpplugin.c
index 92f3cde54c..40a867a410 100644
--- a/libgimp/gimpplugin.c
+++ b/libgimp/gimpplugin.c
@@ -142,7 +142,7 @@ static void       gimp_plug_in_pop_procedure     (GimpPlugIn      *plug_in,
                                                   GimpProcedure   *procedure);
 static void       gimp_plug_in_destroy_hashes    (GimpPlugIn      *plug_in);
 static void       gimp_plug_in_destroy_proxies   (GHashTable      *hash_table,
-                                                  gboolean         finalize);
+                                                  gboolean         destroy_all);
 
 
 G_DEFINE_TYPE_WITH_PRIVATE (GimpPlugIn, gimp_plug_in, G_TYPE_OBJECT)
@@ -1225,7 +1225,13 @@ gimp_plug_in_pop_procedure (GimpPlugIn    *plug_in,
   gimp_plug_in_destroy_proxies (plug_in->priv->items,    FALSE);
 
   if (! plug_in->priv->procedure_stack)
-    gimp_plug_in_destroy_hashes (plug_in);
+    {
+      gimp_plug_in_destroy_proxies (plug_in->priv->displays, TRUE);
+      gimp_plug_in_destroy_proxies (plug_in->priv->images,   TRUE);
+      gimp_plug_in_destroy_proxies (plug_in->priv->items,    TRUE);
+
+      gimp_plug_in_destroy_hashes (plug_in);
+    }
 }
 
 GimpDisplay *
@@ -1362,7 +1368,7 @@ gimp_plug_in_destroy_hashes (GimpPlugIn *plug_in)
 
 static void
 gimp_plug_in_destroy_proxies (GHashTable *hash_table,
-                              gboolean    finalize)
+                              gboolean    destroy_all)
 {
   GHashTableIter iter;
   gpointer       key, value;
@@ -1400,7 +1406,7 @@ gimp_plug_in_destroy_proxies (GHashTable *hash_table,
 
           g_hash_table_iter_remove (&iter);
         }
-      else if (finalize)
+      else if (destroy_all)
         {
           /* this is debug code, a plug-in MUST NOT ref a proxy */
 


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