From 3a53e4743efcaa926b35d9e55737d915126b4875 Mon Sep 17 00:00:00 2001 From: Jehan Date: Sat, 28 Feb 2026 21:52:10 +0100 Subject: [PATCH] app: copy the buffer rather than using it as source. I think the previous code should be OK, but I had some criticals when painting with a paint tool in the area which got extended: > (gimp:577203): GLib-GObject-CRITICAL **: 21:37:08.402: value "-31" of type 'gint' is invalid or out of range for property 'y' of type 'gint' It looks like there lingering pieces from the negative offset in the buffer, which is probably a bug in GEGL? Anyway let's go the shorter route for now, which is to copy the buffer with a different offset. I don't think it's less efficient either anyway. --- app/core/gimpdrawable.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c index 92d3da3577..2960bad122 100644 --- a/app/core/gimpdrawable.c +++ b/app/core/gimpdrawable.c @@ -1041,11 +1041,13 @@ gimp_drawable_real_set_buffer (GimpDrawable *drawable, * This may happen for instance when merging filters which may * render in negative coordinates. */ - buffer = g_object_new (GEGL_TYPE_BUFFER, - "source", buffer, - "shift-x", extent->x, - "shift-y", extent->y, - NULL); + GeglBuffer *buffer2; + GeglRectangle extent2 = { 0, 0, extent->width, extent->height }; + + buffer2 = gegl_buffer_new (&extent2, gegl_buffer_get_format (buffer)); + gimp_gegl_buffer_copy (buffer, extent, GEGL_ABYSS_NONE, buffer2, &extent2); + + buffer = buffer2; free_buffer = TRUE; }