[gimp/gimp-2-10] app: fix a line art leak in bucket fill tool.



commit e9b8122e1886707df73790c88fd55e52492be258
Author: Jehan <jehan girinstud io>
Date:   Tue Nov 20 17:49:12 2018 +0100

    app: fix a line art leak in bucket fill tool.
    
    Introduced in commit b4e12fbbbb:
    gimp_pickable_contiguous_region_prepare_line_art_async() was running
    gimp_pickable_flush(), which provokes the "rendered" signal on the
    image projection when a change occured. As a result, it was calling
    gimp_bucket_fill_compute_line_art() within itself and since
    tool->priv->async was not set yet, none of the call were canceled. Hence
    the same line art is computed twice, but one is leaked.
    Make sure we block this signal handler as a solution.
    
    (cherry picked from commit 36c885a6df2ffb91e7e3c67ec85eacd570d9763c)

 app/tools/gimpbucketfilltool.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c
index a4484e5e71..eeab1b7473 100644
--- a/app/tools/gimpbucketfilltool.c
+++ b/app/tools/gimpbucketfilltool.c
@@ -735,12 +735,23 @@ gimp_bucket_fill_compute_line_art (GimpBucketFillTool *tool)
 
       if (pickable)
         {
+          /* gimp_pickable_contiguous_region_prepare_line_art_async()
+           * will flush the pickable, which may trigger this signal
+           * handler, and will leak a line art (as tool->priv->async has
+           * not been set yet.
+           */
+          g_signal_handlers_block_by_func (gimp_image_get_projection (GIMP_IMAGE (image)),
+                                           G_CALLBACK (gimp_bucket_fill_tool_projection_rendered),
+                                           tool);
           tool->priv->async =
             gimp_pickable_contiguous_region_prepare_line_art_async (
               pickable,
               options->fill_transparent,
               options->line_art_threshold,
               +1);
+          g_signal_handlers_unblock_by_func (gimp_image_get_projection (GIMP_IMAGE (image)),
+                                           G_CALLBACK (gimp_bucket_fill_tool_projection_rendered),
+                                           tool);
 
           gimp_async_add_callback (tool->priv->async,
                                    (GimpAsyncCallback) gimp_bucket_fill_compute_line_art_cb,


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