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.
This commit is contained in:
Jehan
2018-11-20 17:49:12 +01:00
parent 963eef8207
commit 36c885a6df

View File

@ -732,12 +732,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,