diff --git a/app/core/gimpboundary.c b/app/core/gimpboundary.c index ff370a84d0..51becefe29 100644 --- a/app/core/gimpboundary.c +++ b/app/core/gimpboundary.c @@ -132,7 +132,7 @@ static void simplify_subdivide (const GimpBoundSeg *segs, /** * gimp_boundary_find: - * @maskPR: any PixelRegion + * @buffer: a #GeglBuffer * @format: a #Babl float format representing the component to analyze * @type: type of bounds * @x1: left side of bounds @@ -225,7 +225,9 @@ gimp_boundary_sort (const GimpBoundSeg *segs, if (num_segs == 0) return NULL; - /* prepare arrays with GimpBoundSeg pointers sorted by xy1 and xy2 accordingly */ + /* prepare arrays with GimpBoundSeg pointers sorted by xy1 and xy2 + * accordingly + */ segs_ptrs_by_xy1 = g_new (const GimpBoundSeg *, num_segs); segs_ptrs_by_xy2 = g_new (const GimpBoundSeg *, num_segs); @@ -387,6 +389,9 @@ gimp_boundary_offset (GimpBoundSeg *segs, { gint i; + g_return_if_fail ((segs == NULL && num_segs == 0) || + (segs != NULL && num_segs > 0)); + for (i = 0; i < num_segs; i++) { /* dont offset sorting sentinels */ diff --git a/app/core/gimpscanconvert.c b/app/core/gimpscanconvert.c index 833ed29152..0c7df764ec 100644 --- a/app/core/gimpscanconvert.c +++ b/app/core/gimpscanconvert.c @@ -247,10 +247,11 @@ gimp_scan_convert_stroke (GimpScanConvert *sc, GArray *dash_info) { sc->do_stroke = TRUE; - sc->width = width; - sc->join = join; - sc->cap = cap; - sc->miter = miter; + sc->width = width; + sc->join = join; + sc->cap = cap; + sc->miter = miter; + if (sc->dash_info) { g_array_free (sc->dash_info, TRUE); diff --git a/app/tools/gimpregionselecttool.c b/app/tools/gimpregionselecttool.c index 3dca9fa3a6..bd4caf8df4 100644 --- a/app/tools/gimpregionselecttool.c +++ b/app/tools/gimpregionselecttool.c @@ -343,7 +343,7 @@ gimp_region_select_tool_calculate (GimpRegionSelectTool *region_sel, gint *n_segs) { GimpDisplayShell *shell = gimp_display_get_shell (display); - GimpBoundSeg *segs; + GimpBoundSeg *segs = NULL; gimp_display_shell_set_override_cursor (shell, GDK_WATCH); @@ -354,25 +354,24 @@ gimp_region_select_tool_calculate (GimpRegionSelectTool *region_sel, GIMP_REGION_SELECT_TOOL_GET_CLASS (region_sel)->get_mask (region_sel, display); - if (! region_sel->region_mask) + if (region_sel->region_mask) { - gimp_display_shell_unset_override_cursor (shell); - - *n_segs = 0; - return NULL; + /* calculate and allocate a new segment array which represents + * the boundary of the contiguous region + */ + segs = gimp_boundary_find (region_sel->region_mask, NULL, + babl_format ("Y float"), + GIMP_BOUNDARY_WITHIN_BOUNDS, + 0, 0, + gegl_buffer_get_width (region_sel->region_mask), + gegl_buffer_get_height (region_sel->region_mask), + GIMP_BOUNDARY_HALF_WAY, + n_segs); + } + else + { + *n_segs = 0; } - - /* calculate and allocate a new segment array which represents the - * boundary of the contiguous region - */ - segs = gimp_boundary_find (region_sel->region_mask, NULL, - babl_format ("Y float"), - GIMP_BOUNDARY_WITHIN_BOUNDS, - 0, 0, - gegl_buffer_get_width (region_sel->region_mask), - gegl_buffer_get_height (region_sel->region_mask), - GIMP_BOUNDARY_HALF_WAY, - n_segs); gimp_display_shell_unset_override_cursor (shell);