app/vectors/gimpstroke.c app/vectors/gimpvectors-preview.c

2003-08-22  Simon Budig  <simon@gimp.org>

	* app/vectors/gimpstroke.c
	* app/vectors/gimpvectors-preview.c
	* app/tools/gimptransformtool.c
	* app/tools/gimpvectortool.c: Added missing checking for NULL
	return values. Hopefully this fixes the crashes others are
	observing.
This commit is contained in:
Simon Budig 2003-08-22 13:00:25 +00:00 committed by Simon Budig
parent 9d31a9db10
commit d368e27e5a
5 changed files with 60 additions and 33 deletions

View file

@ -1,3 +1,12 @@
2003-08-22 Simon Budig <simon@gimp.org>
* app/vectors/gimpstroke.c
* app/vectors/gimpvectors-preview.c
* app/tools/gimptransformtool.c
* app/tools/gimpvectortool.c: Added missing checking for NULL
return values. Hopefully this fixes the crashes others are
observing.
2003-08-22 Simon Budig <simon@gimp.org>
* app/vectors/gimpbezierstroke.c: fixed crash when deleting

View file

@ -764,6 +764,8 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
coords = gimp_stroke_interpolate (stroke, 1.0, &closed);
if (coords)
{
for (i = 0; i < coords->len; i++)
{
GimpCoords *curr = &g_array_index (coords, GimpCoords, i);
@ -783,6 +785,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
}
}
}
}
}
static TileManager *

View file

@ -982,6 +982,8 @@ gimp_vector_tool_draw (GimpDrawTool *draw_tool)
/* the lines to the control handles */
coords = gimp_stroke_get_draw_lines (cur_stroke);
if (coords)
{
if (coords->len % 2 == 0)
{
gint i;
@ -994,6 +996,7 @@ gimp_vector_tool_draw (GimpDrawTool *draw_tool)
}
g_array_free (coords, TRUE);
}
/* the stroke itself */
coords = gimp_stroke_interpolate (cur_stroke, 1.0, &closed);

View file

@ -1000,7 +1000,8 @@ static GArray *
gimp_stroke_real_get_draw_lines (const GimpStroke *stroke)
{
GList *list;
GArray *ret_lines = g_array_new (FALSE, FALSE, sizeof (GimpCoords));
GArray *ret_lines = NULL;
gint count = 0;
for (list = stroke->anchors; list; list = g_list_next (list))
{
@ -1012,16 +1013,24 @@ gimp_stroke_real_get_draw_lines (const GimpStroke *stroke)
{
GimpAnchor *next = list->next->data;
if (count == 0)
ret_lines = g_array_new (FALSE, FALSE, sizeof (GimpCoords));
ret_lines = g_array_append_val (ret_lines, anchor->position);
ret_lines = g_array_append_val (ret_lines, next->position);
count += 1;
}
if (list->prev)
{
GimpAnchor *prev = list->prev->data;
if (count == 0)
ret_lines = g_array_new (FALSE, FALSE, sizeof (GimpCoords));
ret_lines = g_array_append_val (ret_lines, anchor->position);
ret_lines = g_array_append_val (ret_lines, prev->position);
count += 1;
}
}
}

View file

@ -67,6 +67,8 @@ gimp_vectors_get_new_preview (GimpViewable *viewable,
coords = gimp_stroke_interpolate (cur_stroke, 0.5, &closed);
if (coords)
{
for (i = 0; i < coords->len; i++)
{
GimpCoords point;
@ -83,6 +85,7 @@ gimp_vectors_get_new_preview (GimpViewable *viewable,
g_array_free (coords, TRUE);
}
}
return temp_buf;
}