Make gimp_buffer_new() ref the passed tiles

and clean up gimp-edit.c a bit as a result.
This commit is contained in:
Michael Natterer 2010-03-19 09:52:29 +01:00
parent d00a2c2e58
commit de583d4c28
2 changed files with 16 additions and 11 deletions

View File

@ -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

View File

@ -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