Commit de583d4c authored by Michael Natterer's avatar Michael Natterer 😴

Make gimp_buffer_new() ref the passed tiles

and clean up gimp-edit.c a bit as a result.
parent d00a2c2e
......@@ -57,8 +57,6 @@ static GimpBuffer * gimp_edit_extract (GimpImage *image,
GimpContext *context,
gboolean cut_pixels,
GError **error);
static GimpBuffer * gimp_edit_make_buffer (Gimp *gimp,
TileManager *tiles);
static gboolean gimp_edit_fill_internal (GimpImage *image,
GimpDrawable *drawable,
GimpContext *context,
......@@ -509,14 +507,16 @@ gimp_edit_extract (GimpImage *image,
if (cut_pixels)
gimp_image_undo_group_end (image);
return gimp_edit_make_buffer (image->gimp, tiles);
}
if (tiles)
{
GimpBuffer *buffer = gimp_buffer_new (tiles, _("Global Buffer"), FALSE);
static GimpBuffer *
gimp_edit_make_buffer (Gimp *gimp,
TileManager *tiles)
{
return tiles ? gimp_buffer_new (tiles, _("Global Buffer"), FALSE) : NULL;
tile_manager_unref (tiles);
return buffer;
}
return NULL;
}
static gboolean
......
......@@ -246,7 +246,7 @@ gimp_buffer_new (TileManager *tiles,
}
else
{
buffer->tiles = tiles;
buffer->tiles = tile_manager_ref (tiles);
}
return buffer;
......@@ -256,6 +256,7 @@ GimpBuffer *
gimp_buffer_new_from_pixbuf (GdkPixbuf *pixbuf,
const gchar *name)
{
GimpBuffer *buffer;
TileManager *tiles;
guchar *pixels;
PixelRegion destPR;
......@@ -284,7 +285,11 @@ gimp_buffer_new_from_pixbuf (GdkPixbuf *pixbuf,
pixel_region_set_row (&destPR, 0, y, width, pixels);
}
return gimp_buffer_new (tiles, name, FALSE);
buffer = gimp_buffer_new (tiles, name, FALSE);
tile_manager_unref (tiles);
return buffer;
}
gint
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment