[gimp] app: in bucket-fill tool, fix potential leak when computing line-art
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: in bucket-fill tool, fix potential leak when computing line-art
- Date: Mon, 19 Nov 2018 16:08:01 +0000 (UTC)
commit 2e45c4c8c889d25f3ce3c441e09e02a0dd2a31d3
Author: Ell <ell_se yahoo com>
Date: Mon Nov 19 10:54:05 2018 -0500
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.
app/tools/gimpbucketfilltool.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c
index 313f474f22..dc3e18b020 100644
--- a/app/tools/gimpbucketfilltool.c
+++ b/app/tools/gimpbucketfilltool.c
@@ -336,8 +336,6 @@ gimp_bucket_fill_tool_start (GimpBucketFillTool *tool,
tool->priv->async)
{
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,
data->fill_transparent,
data->line_art_threshold);
precompute_data_free (data);
- if (gimp_async_is_canceled (async))
- {
- g_object_unref (line_art);
- gimp_async_abort (async);
- return;
- }
- 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,
return;
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]