[gimp/gimp-2-10] Issue #1723: gih file that crashes gimp-2.10.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #1723: gih file that crashes gimp-2.10.
- Date: Wed, 27 Jun 2018 16:11:02 +0000 (UTC)
commit b585201e5e46a1117c3956d66371c803df85ab62
Author: Jehan <jehan girinstud io>
Date: Wed Jun 27 18:03:37 2018 +0200
Issue #1723: gih file that crashes gimp-2.10.
The flag `free_selection_string` is used to track an array of strings
with some of them being static and others allocated. This should have
been an array of boolean but we can't change it because it is public API
(though it should really not have been!).
So let's just allocate every string of the `selection` array instead,
which makes the boolean flag useless now.
app/core/gimpbrushpipe-load.c | 3 +--
libgimpbase/gimpparasiteio.c | 7 ++-----
libgimpbase/gimpparasiteio.h | 1 +
3 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/app/core/gimpbrushpipe-load.c b/app/core/gimpbrushpipe-load.c
index cecabe011a..863e91ea86 100644
--- a/app/core/gimpbrushpipe-load.c
+++ b/app/core/gimpbrushpipe-load.c
@@ -156,8 +156,7 @@ gimp_brush_pipe_load (GimpContext *context,
pipe->select[i] = PIPE_SELECT_TILT_Y;
else
pipe->select[i] = PIPE_SELECT_CONSTANT;
- if (params.free_selection_string)
- g_free (params.selection[i]);
+ g_free (params.selection[i]);
pipe->index[i] = 0;
}
}
diff --git a/libgimpbase/gimpparasiteio.c b/libgimpbase/gimpparasiteio.c
index 5880977067..1f32a8c3e2 100644
--- a/libgimpbase/gimpparasiteio.c
+++ b/libgimpbase/gimpparasiteio.c
@@ -64,10 +64,7 @@ gimp_pixpipe_params_init (GimpPixPipeParams *params)
params->placement = "constant";
params->free_placement_string = FALSE;
for (i = 0; i < GIMP_PIXPIPE_MAXDIM; i++)
- {
- params->selection[i] = "random";
- params->free_selection_string = FALSE;
- }
+ params->selection[i] = g_strdup ("random");
params->rank[0] = 1;
for (i = 1; i < GIMP_PIXPIPE_MAXDIM; i++)
params->rank[i] = 0;
@@ -156,8 +153,8 @@ gimp_pixpipe_params_parse (const gchar *string,
i = atoi (p + strlen ("sel"));
if (i >= 0 && i < params->dim)
{
+ g_free (params->selection[i]);
params->selection[i] = g_strdup (r + 1);
- params->free_selection_string = TRUE;
}
}
}
diff --git a/libgimpbase/gimpparasiteio.h b/libgimpbase/gimpparasiteio.h
index 0e61d353b8..e1482e4f8b 100644
--- a/libgimpbase/gimpparasiteio.h
+++ b/libgimpbase/gimpparasiteio.h
@@ -53,6 +53,7 @@ struct _GimpPixPipeParams
gboolean free_placement_string;
gint rank[GIMP_PIXPIPE_MAXDIM];
gchar *selection[GIMP_PIXPIPE_MAXDIM];
+ /* this flag is now useless. All selection strings are allocated. */
gboolean free_selection_string;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]