Commit 707e5976 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added "gint ref_count" to the TileManager struct.

2003-05-26  Michael Natterer  <mitch@gimp.org>

	* app/base/tile-manager-private.h: added "gint ref_count" to the
	TileManager struct.

	* app/base/tile-manager.[ch]: replaced tile_manager_destroy()
	by tile_manager_ref() and tile_manager_unref().

	* app/core/gimpimage-undo-push.c: ref the tile managers stored in
	the undo system and DON'T destroy them if no undo could be pushed.
	Should fix the remaining crashes with undo disabled like in
	bug #9350.

	(!!!) Note that the tiles passed to gimp_image_undo_push_image()
	and gimp_drawable_push_undo() as well as the tile managers of
	drawables passed to gimp_image_undo_push_[layer|channel]_mod()
	must be unref'ed by the caller now.

	* app/core/gimpdrawable-transform.c (gimp_drawable_transform_paste):
	don't take ownership of the passed tiles but ref them if needed.

	(!!!) Callers must unref the passed tiles themselves now.

	* app/core/gimpbuffer.c
	* app/core/gimpdrawable-blend.c
	* app/core/gimpdrawable-bucket-fill.c
	* app/core/gimpdrawable-offset.c
	* app/core/gimpdrawable.c
	* app/core/gimpedit.c
	* app/core/gimpimage-convert.c
	* app/core/gimpimage-mask.c
	* app/core/gimpimage-projection.c
	* app/core/gimpimage.c
	* app/core/gimpimagemap.c
	* app/core/gimplayer-floating-sel.c
	* app/core/gimplayer.c
	* app/paint/gimppaintcore.c
	* app/text/gimptextlayer.c
	* app/tools/gimpinktool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimptransformtool-undo.c
	* app/tools/gimptransformtool.c: changed accordingly.
parent 35872fbc
2003-05-26 Michael Natterer <mitch@gimp.org>
* app/base/tile-manager-private.h: added "gint ref_count" to the
TileManager struct.
* app/base/tile-manager.[ch]: replaced tile_manager_destroy()
by tile_manager_ref() and tile_manager_unref().
* app/core/gimpimage-undo-push.c: ref the tile managers stored in
the undo system and DON'T destroy them if no undo could be pushed.
Should fix the remaining crashes with undo disabled like in
bug #9350.
(!!!) Note that the tiles passed to gimp_image_undo_push_image()
and gimp_drawable_push_undo() as well as the tile managers of
drawables passed to gimp_image_undo_push_[layer|channel]_mod()
must be unref'ed by the caller now.
* app/core/gimpdrawable-transform.c (gimp_drawable_transform_paste):
don't take ownership of the passed tiles but ref them if needed.
(!!!) Callers must unref the passed tiles themselves now.
* app/core/gimpbuffer.c
* app/core/gimpdrawable-blend.c
* app/core/gimpdrawable-bucket-fill.c
* app/core/gimpdrawable-offset.c
* app/core/gimpdrawable.c
* app/core/gimpedit.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-mask.c
* app/core/gimpimage-projection.c
* app/core/gimpimage.c
* app/core/gimpimagemap.c
* app/core/gimplayer-floating-sel.c
* app/core/gimplayer.c
* app/paint/gimppaintcore.c
* app/text/gimptextlayer.c
* app/tools/gimpinktool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimptransformtool-undo.c
* app/tools/gimptransformtool.c: changed accordingly.
2003-05-26 Raphael Quinet <quinet@gamers.org>
* plug-ins/imagemap/Makefile.am: Moved the -i flag for lex.
......@@ -22,6 +22,8 @@
struct _TileManager
{
gint ref_count; /* reference counter */
gint x, y; /* tile manager offsets */
gint width; /* the width of the tiled area */
......
......@@ -46,54 +46,70 @@ tile_manager_new (gint toplevel_width,
gint width;
gint height;
tm = g_new (TileManager, 1);
tm->user_data = NULL;
tm->validate_proc = NULL;
tm = g_new0 (TileManager, 1);
width = toplevel_width;
height = toplevel_height;
tm->x = 0;
tm->y = 0;
tm->width = width;
tm->height = height;
tm->bpp = bpp;
tm->ntile_rows = (height + TILE_HEIGHT - 1) / TILE_HEIGHT;
tm->ntile_cols = (width + TILE_WIDTH - 1) / TILE_WIDTH;
tm->tiles = NULL;
tm->cached_num = -1;
tm->cached_tile = NULL;
tm->ref_count = 1;
tm->x = 0;
tm->y = 0;
tm->width = width;
tm->height = height;
tm->bpp = bpp;
tm->ntile_rows = (height + TILE_HEIGHT - 1) / TILE_HEIGHT;
tm->ntile_cols = (width + TILE_WIDTH - 1) / TILE_WIDTH;
tm->tiles = NULL;
tm->validate_proc = NULL;
tm->cached_num = -1;
tm->cached_tile = NULL;
tm->user_data = NULL;
return tm;
}
void
tile_manager_destroy (TileManager *tm)
TileManager *
tile_manager_ref (TileManager *tm)
{
gint ntiles;
gint i;
g_return_val_if_fail (tm != NULL, NULL);
tm->ref_count++;
return tm;
}
void
tile_manager_unref (TileManager *tm)
{
g_return_if_fail (tm != NULL);
if (tm->cached_tile)
tile_release (tm->cached_tile, FALSE);
if (tm->tiles)
tm->ref_count--;
if (tm->ref_count < 1)
{
ntiles = tm->ntile_rows * tm->ntile_cols;
gint ntiles;
gint i;
for (i = 0; i < ntiles; i++)
{
TILE_MUTEX_LOCK (tm->tiles[i]);
tile_detach (tm->tiles[i], tm, i);
}
if (tm->cached_tile)
tile_release (tm->cached_tile, FALSE);
g_free (tm->tiles);
}
if (tm->tiles)
{
ntiles = tm->ntile_rows * tm->ntile_cols;
for (i = 0; i < ntiles; i++)
{
TILE_MUTEX_LOCK (tm->tiles[i]);
tile_detach (tm->tiles[i], tm, i);
}
g_free (tm);
g_free (tm->tiles);
}
g_free (tm);
}
}
......
......@@ -42,9 +42,10 @@ TileManager * tile_manager_new (gint toplevel_width,
gint toplevel_height,
gint bpp);
/* Destroy a tile manager and all the tiles it contains.
/* Ref/Unref a tile manager.
*/
void tile_manager_destroy (TileManager *tm);
TileManager * tile_manager_ref (TileManager *tm);
void tile_manager_unref (TileManager *tm);
/* Set the validate procedure for the tile manager.
* The validate procedure is called when an invalid tile
......
......@@ -76,7 +76,7 @@ gimp_edit_cut (GimpImage *gimage,
if (cropped_cut != cut)
{
tile_manager_destroy (cut);
tile_manager_unref (cut);
cut = NULL;
}
}
......@@ -134,7 +134,7 @@ gimp_edit_copy (GimpImage *gimage,
if (cropped_copy != copy)
{
tile_manager_destroy (copy);
tile_manager_unref (copy);
copy = NULL;
}
}
......@@ -323,7 +323,7 @@ gimp_edit_clear (GimpImage *gimage,
(x2 - x1), (y2 - y1));
/* free the temporary tiles */
tile_manager_destroy (buf_tiles);
tile_manager_unref (buf_tiles);
return TRUE;
}
......@@ -405,7 +405,7 @@ gimp_edit_fill (GimpImage *gimage,
(x2 - x1), (y2 - y1));
/* free the temporary tiles */
tile_manager_destroy (buf_tiles);
tile_manager_unref (buf_tiles);
return TRUE;
}
......@@ -847,11 +847,14 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
NULL, NULL);
/* Free the cut/copied buffer */
tile_manager_destroy (orig_tiles);
tile_manager_unref (orig_tiles);
if (new_tiles)
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
{
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
tile_manager_unref (new_tiles);
}
}
/* push the undo group end */
......@@ -911,11 +914,14 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
flip_type, axis, FALSE);
/* Free the cut/copied buffer */
tile_manager_destroy (orig_tiles);
tile_manager_unref (orig_tiles);
if (new_tiles)
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
{
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
tile_manager_unref (new_tiles);
}
}
/* push the undo group end */
......@@ -966,11 +972,14 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
FALSE);
/* Free the cut/copied buffer */
tile_manager_destroy (orig_tiles);
tile_manager_unref (orig_tiles);
if (new_tiles)
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
{
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
tile_manager_unref (new_tiles);
}
}
/* push the undo group end */
......@@ -1062,9 +1071,6 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
/* End the group undo */
gimp_image_undo_group_end (gimage);
/* Free the tiles */
tile_manager_destroy (tiles);
return TRUE;
}
else
......@@ -1102,7 +1108,8 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
channel);
/* set the current layer's data */
drawable->tiles = tiles;
tile_manager_unref (drawable->tiles);
drawable->tiles = tile_manager_ref (tiles);
/* Fill in the new layer's attributes */
GIMP_ITEM (drawable)->width = tile_manager_width (tiles);
......
......@@ -128,7 +128,7 @@ gimp_buffer_finalize (GObject *object)
if (buffer->tiles)
{
tile_manager_destroy (buffer->tiles);
tile_manager_unref (buffer->tiles);
buffer->tiles = NULL;
}
......
......@@ -226,7 +226,7 @@ gimp_drawable_blend (GimpDrawable *drawable,
if (distR.tiles)
{
tile_manager_destroy (distR.tiles);
tile_manager_unref (distR.tiles);
distR.tiles = NULL;
}
......@@ -240,7 +240,7 @@ gimp_drawable_blend (GimpDrawable *drawable,
gimp_drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1));
/* free the temporary buffer */
tile_manager_destroy (buf_tiles);
tile_manager_unref (buf_tiles);
gimp_unset_busy (gimage->gimp);
}
......@@ -675,7 +675,7 @@ gradient_precalc_shapeburst (GimpImage *gimage,
pixel_region_init (&distR, distR.tiles, 0, 0, PR->w, PR->h, FALSE);
}
tile_manager_destroy (tempR.tiles);
tile_manager_unref (tempR.tiles);
}
......
......@@ -320,7 +320,7 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
TRUE, _("Bucket Fill"),
opacity, paint_mode,
NULL, x1, y1);
tile_manager_destroy (buf_tiles);
tile_manager_unref (buf_tiles);
/* update the image */
gimp_drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1));
......
......@@ -322,6 +322,7 @@ gimp_drawable_offset (GimpDrawable *drawable,
FALSE);
/* swap the tiles */
tile_manager_unref (drawable->tiles);
drawable->tiles = new_tiles;
/* update the drawable */
......
......@@ -847,11 +847,14 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
NULL, NULL);
/* Free the cut/copied buffer */
tile_manager_destroy (orig_tiles);
tile_manager_unref (orig_tiles);
if (new_tiles)
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
{
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
tile_manager_unref (new_tiles);
}
}
/* push the undo group end */
......@@ -911,11 +914,14 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
flip_type, axis, FALSE);
/* Free the cut/copied buffer */
tile_manager_destroy (orig_tiles);
tile_manager_unref (orig_tiles);
if (new_tiles)
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
{
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
tile_manager_unref (new_tiles);
}
}
/* push the undo group end */
......@@ -966,11 +972,14 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
FALSE);
/* Free the cut/copied buffer */
tile_manager_destroy (orig_tiles);
tile_manager_unref (orig_tiles);
if (new_tiles)
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
{
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
tile_manager_unref (new_tiles);
}
}
/* push the undo group end */
......@@ -1062,9 +1071,6 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
/* End the group undo */
gimp_image_undo_group_end (gimage);
/* Free the tiles */
tile_manager_destroy (tiles);
return TRUE;
}
else
......@@ -1102,7 +1108,8 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
channel);
/* set the current layer's data */
drawable->tiles = tiles;
tile_manager_unref (drawable->tiles);
drawable->tiles = tile_manager_ref (tiles);
/* Fill in the new layer's attributes */
GIMP_ITEM (drawable)->width = tile_manager_width (tiles);
......
......@@ -217,7 +217,7 @@ gimp_drawable_finalize (GObject *object)
if (drawable->tiles)
{
tile_manager_destroy (drawable->tiles);
tile_manager_unref (drawable->tiles);
drawable->tiles = NULL;
}
......@@ -365,6 +365,7 @@ gimp_drawable_scale (GimpItem *item,
gimp_drawable_is_indexed (drawable) ?
GIMP_INTERPOLATION_NONE : interpolation_type);
tile_manager_unref (drawable->tiles);
drawable->tiles = new_tiles;
GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height,
......@@ -444,6 +445,7 @@ gimp_drawable_resize (GimpItem *item,
copy_region (&srcPR, &destPR);
}
tile_manager_unref (drawable->tiles);
drawable->tiles = new_tiles;
GIMP_ITEM_CLASS (parent_class)->resize (item, new_width, new_height,
......@@ -481,7 +483,10 @@ gimp_drawable_flip (GimpItem *item,
tile_manager_set_offsets (drawable->tiles, old_off_x, old_off_y);
if (tiles)
gimp_drawable_transform_paste (drawable, tiles, FALSE);
{
gimp_drawable_transform_paste (drawable, tiles, FALSE);
tile_manager_unref (tiles);
}
}
static void
......@@ -511,7 +516,10 @@ gimp_drawable_rotate (GimpItem *item,
tile_manager_set_offsets (drawable->tiles, old_off_x, old_off_y);
if (tiles)
gimp_drawable_transform_paste (drawable, tiles, FALSE);
{
gimp_drawable_transform_paste (drawable, tiles, FALSE);
tile_manager_unref (tiles);
}
}
static void
......@@ -546,7 +554,10 @@ gimp_drawable_transform (GimpItem *item,
tile_manager_set_offsets (drawable->tiles, old_off_x, old_off_y);
if (tiles)
gimp_drawable_transform_paste (drawable, tiles, FALSE);
{
gimp_drawable_transform_paste (drawable, tiles, FALSE);
tile_manager_unref (tiles);
}
}
void
......@@ -570,7 +581,7 @@ gimp_drawable_configure (GimpDrawable *drawable,
drawable->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
if (drawable->tiles)
tile_manager_destroy (drawable->tiles);
tile_manager_unref (drawable->tiles);
drawable->tiles = tile_manager_new (width, height,
drawable->bytes);
......
......@@ -76,7 +76,7 @@ gimp_edit_cut (GimpImage *gimage,
if (cropped_cut != cut)
{
tile_manager_destroy (cut);
tile_manager_unref (cut);
cut = NULL;
}
}
......@@ -134,7 +134,7 @@ gimp_edit_copy (GimpImage *gimage,
if (cropped_copy != copy)
{
tile_manager_destroy (copy);
tile_manager_unref (copy);
copy = NULL;
}
}
......@@ -323,7 +323,7 @@ gimp_edit_clear (GimpImage *gimage,
(x2 - x1), (y2 - y1));
/* free the temporary tiles */
tile_manager_destroy (buf_tiles);
tile_manager_unref (buf_tiles);
return TRUE;
}
......@@ -405,7 +405,7 @@ gimp_edit_fill (GimpImage *gimage,
(x2 - x1), (y2 - y1));
/* free the temporary tiles */
tile_manager_destroy (buf_tiles);
tile_manager_unref (buf_tiles);
return TRUE;
}
......@@ -927,6 +927,8 @@ gimp_image_convert (GimpImage *gimage,
/* Push the layer onto the undo stack */
gimp_image_undo_push_layer_mod (gimage, NULL, layer);
tile_manager_unref (GIMP_DRAWABLE (layer)->tiles);
GIMP_DRAWABLE (layer)->tiles = new_tiles;
GIMP_DRAWABLE (layer)->type = new_layer_type;
GIMP_DRAWABLE (layer)->bytes = GIMP_IMAGE_TYPE_BYTES (new_layer_type);
......
......@@ -406,7 +406,7 @@ gimp_image_mask_float (GimpImage *gimage,
GIMP_ITEM (layer)->offset_y = y1 + off_y;
/* Free the temp buffer */
tile_manager_destroy (tiles);
tile_manager_unref (tiles);
/* Add the floating layer to the gimage */
floating_sel_attach (layer, drawable);
......
......@@ -131,7 +131,7 @@ gimp_image_projection_free (GimpImage *gimage)
if (gimage->projection)
{
tile_manager_destroy (gimage->projection);
tile_manager_unref (gimage->projection);
gimage->projection = NULL;
}
}
......@@ -141,9 +141,9 @@ gimp_image_projection (GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if ((gimage->projection == NULL) ||
(tile_manager_width (gimage->projection) != gimage->width) ||
(tile_manager_height (gimage->projection) != gimage->height))
if (gimage->projection == NULL ||
tile_manager_width (gimage->projection) != gimage->width ||
tile_manager_height (gimage->projection) != gimage->height)
{
gimp_image_projection_allocate (gimage);
}
......
......@@ -187,7 +187,7 @@ gimp_image_undo_push_image_mod (GimpImage *gimage,
image_undo = new->data;
image_undo->tiles = tiles;
image_undo->tiles = tile_manager_ref (tiles);
image_undo->x1 = x1;
image_undo->y1 = y1;
image_undo->x2 = x2;
......@@ -197,8 +197,6 @@ gimp_image_undo_push_image_mod (GimpImage *gimage,
return TRUE;
}
tile_manager_destroy (tiles);
return FALSE;
}
......@@ -239,9 +237,9 @@ undo_pop_image (GimpUndo *undo,
}
else
{
int i, j;
Tile *src_tile;
Tile *dest_tile;
gint i, j;
w = image_undo->x2 - image_undo->x1;
h = image_undo->y2 - image_undo->y1;
......@@ -251,6 +249,7 @@ undo_pop_image (GimpUndo *undo,
for (j = x; j < image_undo->x2; j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
src_tile = tile_manager_get_tile (tiles, j, i, FALSE, FALSE);
if (tile_is_valid (src_tile) == TRUE)
{
/* swap tiles, not pixels! */
......@@ -289,7 +288,7 @@ undo_free_image (GimpUndo *undo,
image_undo = (ImageUndo *) undo->data;
tile_manager_destroy (image_undo->tiles);
tile_manager_unref (image_undo->tiles);
g_free (image_undo);
}
......@@ -878,7 +877,7 @@ gimp_image_undo_push_mask (GimpImage *gimage,
}
if (undo_tiles)
tile_manager_destroy (undo_tiles);
tile_manager_unref (undo_tiles);
return FALSE;
}
......@@ -934,7 +933,7 @@ undo_pop_mask (GimpUndo *undo,
copy_region (&srcPR, &destPR);
tile_manager_destroy (mu->tiles);
tile_manager_unref (mu->tiles);
}
if (channel == gimp_image_get_mask (undo->gimage))
......@@ -996,7 +995,7 @@ undo_free_mask (GimpUndo *undo,
mu = (MaskUndo *) undo->data;
if (mu->tiles)
tile_manager_destroy (mu->tiles);
tile_manager_unref (mu->tiles);
g_free (mu);
}
......@@ -1567,7 +1566,7 @@ gimp_image_undo_push_layer_mod (GimpImage *gimage,
lmu = new->data;
lmu->tiles = tiles;
lmu->tiles = tile_manager_ref (tiles);
lmu->type = GIMP_DRAWABLE (layer)->type;
lmu->offset_x = GIMP_ITEM (layer)->offset_x;
lmu->offset_y = GIMP_ITEM (layer)->offset_y;
......@@ -1575,8 +1574,6 @@ gimp_image_undo_push_layer_mod (GimpImage *gimage,
return TRUE;
}
tile_manager_destroy (tiles);
return FALSE;
}
......@@ -1663,7 +1660,7 @@ undo_free_layer_mod (GimpUndo *undo,
lmu = (LayerModUndo *) undo->data;
tile_manager_destroy (lmu->tiles);
tile_manager_unref (lmu->tiles);
g_free (lmu);
}
......@@ -2204,13 +2201,11 @@ gimp_image_undo_push_channel_mod (GimpImage *gimage,
cmu = new->data;
cmu->tiles = tiles;
cmu->tiles = tile_manager_ref (tiles);
return TRUE;
}
tile_manager_destroy (tiles);
return FALSE;
}
......@@ -2250,7 +2245,7 @@ undo_pop_channel_mod (GimpUndo *undo,
GIMP_DRAWABLE (channel)->tiles = tiles;
GIMP_ITEM (channel)->width = tile_manager_width (tiles);
GIMP_ITEM (channel)->height = tile_manager_height (tiles);
channel->bounds_known = FALSE;
channel->bounds_known = FALSE;
if (GIMP_ITEM (channel)->width != tile_manager_width (cmu->tiles) ||
GIMP_ITEM (channel)->height != tile_manager_height (cmu->tiles))
......@@ -2282,7 +2277,7 @@ undo_free_channel_mod (GimpUndo *undo,
cmu = (ChannelModUndo *) undo->data;
tile_manager_destroy (cmu->tiles);
tile_manager_unref (cmu->tiles);
g_free (cmu);
}
......@@ -2817,7 +2812,7 @@ gimp_image_undo_push_fs_to_layer (GimpImage *gimage,
return TRUE;
}
tile_manager_destroy (floating_layer->fs.backing_store);
tile_manager_unref (floating_layer->fs.backing_store);
floating_layer->fs.backing_store = NULL;
return FALSE;
......@@ -2895,7 +2890,7 @@ undo_free_fs_to_layer (GimpUndo *undo,
if (undo_mode == GIMP_UNDO_MODE_UNDO)
{
tile_manager_destroy (fsu->floating_layer->fs.backing_store);
tile_manager_unref (fsu->floating_layer->fs.backing_store);
fsu->floating_layer->fs.backing_store = NULL;
}
......
......@@ -1611,7 +1611,7 @@ gimp_image_free_shadow (GimpImage *gimage)
if (gimage->shadow)
{
tile_manager_destroy (gimage->shadow);
tile_manager_unref (gimage->shadow);
gimage->shadow = NULL;
}
}
......
......@@ -236,9 +236,9 @@ gimp_image_map_apply (GimpImageMap *image_map,
if (! image_map->undo_tiles ||
width != (x2 - x1) || height != (y2 - y1))
{
/* Destroy old tiles--If they exist */
/* Destroy old tiles */
if (image_map->undo_tiles)
tile_manager_destroy (image_map->undo_tiles);
tile_manager_unref (image_map->undo_tiles);
/* Allocate new tiles */
image_map->undo_tiles =
......@@ -329,6 +329,9 @@ gimp_image_map_commit (GimpImageMap *image_map)
image_map->undo_desc,
x1, y1, x2, y2,
image_map->undo_tiles, FALSE);
tile_manager_unref (image_map->undo_tiles);
image_map->undo_tiles = NULL;
}
g_object_unref (image_map);
......@@ -381,7 +384,7 @@ gimp_image_map_clear (GimpImageMap *image_map)
{
g_message ("image depth change, unable to restore original image");
tile_manager_destroy (image_map->undo_tiles);
tile_manager_unref (image_map->undo_tiles);
gimp_image_undo_thaw (gimage);
#if 0
......@@ -401,7 +404,7 @@ gimp_image_map_clear (GimpImageMap *image_map)
width, height);
/* Free the undo_tiles tile manager */
tile_manager_destroy (image_map->undo_tiles);
tile_manager_unref (image_map->undo_tiles);
image_map->undo_tiles = NULL;