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.
This commit is contained in:
Ell
2018-11-30 03:32:33 -05:00
parent 49fd2847ac
commit 7c00cf498a
2 changed files with 7 additions and 4 deletions

View File

@ -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);

View File

@ -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