vips_getpoint() frees input region sooner

we were leaving a region active after _build(), which caused problems later if
another operation triggered a rewind (for example)
This commit is contained in:
John Cupitt 2014-12-16 13:26:01 +00:00
parent 71bb0e81d1
commit 9b3351f73a
2 changed files with 10 additions and 6 deletions

View File

@ -17,6 +17,8 @@
* - read_getpoint partial-ised
* 10/2/14
* - redo as a class
* 16/12/14
* - free the input region much earlier
*/
/*
@ -97,17 +99,19 @@ vips_getpoint_build( VipsObject *object )
if( vips_check_coding_known( class->nickname, getpoint->in ) ||
!(region = vips_region_new( getpoint->in )) )
return( -1 );
vips_object_local( object, region );
area.left = getpoint->x;
area.top = getpoint->y;
area.width = 1;
area.height = 1;
if( vips_region_prepare( region, &area ) )
if( vips_region_prepare( region, &area ) ||
!(vector = vips__ink_to_vector( class->nickname, getpoint->in,
VIPS_REGION_ADDR( region, area.left, area.top ),
&n )) ) {
VIPS_UNREF( region );
return( -1 );
if( !(vector = vips__ink_to_vector( class->nickname, getpoint->in,
VIPS_REGION_ADDR( region, getpoint->x, getpoint->y ), &n )) )
return( -1 );
}
VIPS_UNREF( region );
out_array = vips_array_double_new( vector, n );
g_object_set( object,

View File

@ -2925,7 +2925,7 @@ vips_image_wio_input( VipsImage *image )
/* We need to zap any start/gen/stop callbacks. If we don't,
* calling vips_region_prepare_to() later to read from this
* image will fail, since it will think it need to create the
* image will fail, since it will think it needs to create the
* image, not read from it.
*/
image->start_fn = NULL;