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



commit bea1a44672f864a46d7d743d64a350436fd6307d
Author: Ell <ell_se yahoo com>
Date:   Sat May 11 05:10:16 2019 -0400

    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.

 app/paint/gimpbrushcore.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index d2f499fdb1..e588f4bbe0 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]