Commit 2e45c4c8 authored by Ell's avatar Ell

app: in bucket-fill tool, fix potential leak when computing line-art

In the line-art async function, pass ownership over the resulting
buffer to the async object, so that the buffer is properly freed in
case the async in canceled after line-art computation is complete,
but before the completion callback is called.

Also, clear the tool's async pointer in the completion callback, to
avoid leaking the last issued async.
parent 4575949c
......@@ -336,8 +336,6 @@ gimp_bucket_fill_tool_start (GimpBucketFillTool *tool,
gimp_waitable_wait (GIMP_WAITABLE (tool->priv->async));
g_object_unref (tool->priv->async);
tool->priv->async = NULL;
......@@ -706,13 +704,7 @@ gimp_bucket_fill_compute_line_art_async (GimpAsync *async,
precompute_data_free (data);
if (gimp_async_is_canceled (async))
g_object_unref (line_art);
gimp_async_abort (async);
gimp_async_finish (async, line_art);
gimp_async_finish_full (async, line_art, g_object_unref);
static void
......@@ -723,7 +715,9 @@ gimp_bucket_fill_compute_line_art_cb (GimpAsync *async,
if (gimp_async_is_finished (async))
tool->priv->line_art = gimp_async_get_result (async);
tool->priv->line_art = g_object_ref (gimp_async_get_result (async));
g_clear_object (&tool->priv->async);
static void
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment