[gimp/gimp-2-10] app: use gimp_async_add_callback_for_object() in various places



commit b493cb51f4361e8eadf3139dc27ca03c0ebf28e7
Author: Ell <ell_se yahoo com>
Date:   Fri Nov 30 03:32:33 2018 -0500

    app: use gimp_async_add_callback_for_object() in various places
    
    Use gimp_async_add_callback_for_object(), added in the previous
    commit, instead of gimp_async_add_callback(), in cases where the
    destructor of the object owning the async doesn't wait for the
    async to finish.  This avoids leaking such ongoing asyncs on
    shutdown, during which gimp-parallel either finishes or aborts the
    asyncs: if at this point an async has any registered callbacks, an
    idle source is added for running the callbacks, extending the
    lifetime of the async; however, since we're not getting back into
    the main loop, the idle is never run, and the async (and any
    associated resources) are never freed.
    
    (cherry picked from commit 7c00cf498af3de9b2d9ef4208a3d3169cae64c2c)

 app/text/gimpfontfactory.c             | 8 +++++---
 app/widgets/gimpviewrendererdrawable.c | 3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/app/text/gimpfontfactory.c b/app/text/gimpfontfactory.c
index 2cf5ab4558..1ca0660b11 100644
--- a/app/text/gimpfontfactory.c
+++ b/app/text/gimpfontfactory.c
@@ -336,9 +336,11 @@ gimp_font_factory_load (GimpFontFactory  *factory,
     (GimpParallelRunAsyncFunc) gimp_font_factory_load_async,
     config);
 
-  gimp_async_add_callback (async,
-                           (GimpAsyncCallback) gimp_font_factory_load_async_callback,
-                           factory);
+  gimp_async_add_callback_for_object (
+    async,
+    (GimpAsyncCallback) gimp_font_factory_load_async_callback,
+    factory,
+    factory);
 
   gimp_async_set_add (async_set, async);
 
diff --git a/app/widgets/gimpviewrendererdrawable.c b/app/widgets/gimpviewrendererdrawable.c
index d8803298c5..a44df83bec 100644
--- a/app/widgets/gimpviewrendererdrawable.c
+++ b/app/widgets/gimpviewrendererdrawable.c
@@ -308,9 +308,10 @@ gimp_view_renderer_drawable_render (GimpViewRenderer *renderer,
       renderdrawable->priv->render_buf_y  = dst_y;
       renderdrawable->priv->render_update = FALSE;
 
-      gimp_async_add_callback (
+      gimp_async_add_callback_for_object (
         async,
         (GimpAsyncCallback) gimp_view_renderer_drawable_render_async_callback,
+        renderdrawable,
         renderdrawable);
 
       /* if rendering isn't done yet, update the render-view once it is, and


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