app: in GimpBrushCore, free old paint buffer before allocating new one

In gimp_brush_core_get_paint_buffer(), when allocating a new paint
buffer, clear the old buffer *before* allocating the new one, to
reduce the amount of simultaneously allocated memory.
This commit is contained in:
Ell
2019-05-11 05:10:16 -04:00
parent 088827e563
commit bea1a44672

View File

@ -839,14 +839,14 @@ gimp_brush_core_get_paint_buffer (GimpPaintCore *paint_core,
return paint_core->paint_buffer;
}
g_clear_object (&paint_core->paint_buffer);
temp_buf = gimp_temp_buf_new ((x2 - x1), (y2 - y1),
format);
*paint_buffer_x = x1;
*paint_buffer_y = y1;
g_clear_object (&paint_core->paint_buffer);
paint_core->paint_buffer = gimp_temp_buf_create_buffer (temp_buf);
gimp_temp_buf_unref (temp_buf);