[gimp/gimp-2-10] app: in bucket-fill tool, fix potential leak when computing line-art
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: in bucket-fill tool, fix potential leak when computing line-art
- Date: Wed, 19 Dec 2018 15:44:09 +0000 (UTC)
commit 17789431528ae637d626c5a1042ba1287222a95c
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.
(cherry picked from commit 2e45c4c8c889d25f3ce3c441e09e02a0dd2a31d3)
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 7da02f326d..0386c958a0 100644
--- a/app/tools/gimpbucketfilltool.c
+++ b/app/tools/gimpbucketfilltool.c
@@ -339,8 +339,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;
}
}
@@ -709,13 +707,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
@@ -726,7 +718,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]