use a temporary variable to store the return value of tile_manager_get()

2007-09-07  Michael Natterer  <mitch@gimp.org>

	* app/base/tile-manager.c (read_pixel_data_1): use a temporary
	variable to store the return value of tile_manager_get() instead
	of assigning to tm->cached_tile directly to make sure
	tm->cached_num and tm->cached_tile are always in a consistent
	state (the requested tile might be invalid and needs to be
	validated, which would call tile_manager_get() recursively, which
	in turn would clear the cached tile). Fixes bug #472770.


svn path=/trunk/; revision=23472
This commit is contained in:
Michael Natterer
2007-09-07 08:35:21 +00:00
committed by Michael Natterer
parent dd7fa05cdc
commit 15c969c862
2 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,13 @@
2007-09-07 Michael Natterer <mitch@gimp.org>
* app/base/tile-manager.c (read_pixel_data_1): use a temporary
variable to store the return value of tile_manager_get() instead
of assigning to tm->cached_tile directly to make sure
tm->cached_num and tm->cached_tile are always in a consistent
state (the requested tile might be invalid and needs to be
validated, which would call tile_manager_get() recursively, which
in turn would clear the cached tile). Fixes bug #472770.
2007-09-06 Martin Nordholts <martinn@svn.gnome.org> 2007-09-06 Martin Nordholts <martinn@svn.gnome.org>
* app/tools/gimprectangletool.c (gimp_rectangle_tool_auto_shrink): * app/tools/gimprectangletool.c (gimp_rectangle_tool_auto_shrink):

View File

@ -767,11 +767,25 @@ read_pixel_data_1 (TileManager *tm,
if (num != tm->cached_num) /* must fetch a new tile */ if (num != tm->cached_num) /* must fetch a new tile */
{ {
Tile *tile;
if (tm->cached_tile) if (tm->cached_tile)
tile_release (tm->cached_tile, FALSE); tile_release (tm->cached_tile, FALSE);
tm->cached_num = -1;
tm->cached_tile = NULL;
/* use a temporary variable instead of assigning to
* tm->cached_tile directly to make sure tm->cached_num
* and tm->cached_tile are always in a consistent state.
* (the requested tile might be invalid and needs to be
* validated, which would call tile_manager_get() recursively,
* which in turn would clear the cached tile) See bug #472770.
*/
tile = tile_manager_get (tm, num, TRUE, FALSE);
tm->cached_num = num; tm->cached_num = num;
tm->cached_tile = tile_manager_get (tm, num, TRUE, FALSE); tm->cached_tile = tile;
} }
if (tm->cached_tile) if (tm->cached_tile)