fix a segv
vips_image_write() needs to ref its argument if it's a delayed calculation ... fixes a segv under heavy load
This commit is contained in:
parent
3297400952
commit
91837d8277
@ -1651,6 +1651,14 @@ vips_image_write( VipsImage *image, VipsImage *out )
|
||||
vips_demand_hint( out,
|
||||
VIPS_DEMAND_STYLE_THINSTRIP, image, NULL );
|
||||
|
||||
/* If this will be a delayed calculation we need to keep @image
|
||||
* around for as long as @out is about.
|
||||
*/
|
||||
if( vips_image_ispartial( image ) ) {
|
||||
g_object_ref( image );
|
||||
vips_object_local( out, image );
|
||||
}
|
||||
|
||||
if( vips_image_generate( out,
|
||||
vips_start_one, vips_image_write_gen, vips_stop_one,
|
||||
image, NULL ) )
|
||||
|
@ -282,6 +282,7 @@ vips_region_dispose( GObject *gobject )
|
||||
image->regions = g_slist_remove( image->regions, region );
|
||||
g_mutex_unlock( image->sslock );
|
||||
region->im = NULL;
|
||||
|
||||
g_object_unref( image );
|
||||
|
||||
G_OBJECT_CLASS( vips_region_parent_class )->dispose( gobject );
|
||||
@ -461,20 +462,26 @@ vips_region_new( VipsImage *image )
|
||||
{
|
||||
VipsRegion *region;
|
||||
|
||||
region = VIPS_REGION( g_object_new( VIPS_TYPE_REGION, NULL ) );
|
||||
|
||||
/* We can't use the property system, we need to be very threaded.
|
||||
/* Ref quickly, we want to make sure we keep the image around.
|
||||
* We can't use the property system, we need to be very threaded.
|
||||
*/
|
||||
region->im = image;
|
||||
g_object_ref( image );
|
||||
|
||||
g_assert( G_OBJECT( image )->ref_count > 1 );
|
||||
|
||||
#ifdef DEBUG
|
||||
g_assert( vips_object_sanity( VIPS_OBJECT( image ) ) );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
region = VIPS_REGION( g_object_new( VIPS_TYPE_REGION, NULL ) );
|
||||
region->im = image;
|
||||
|
||||
if( vips_object_build( VIPS_OBJECT( region ) ) ) {
|
||||
VIPS_UNREF( region );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
g_assert( vips_object_sanity( VIPS_OBJECT( image ) ) );
|
||||
g_assert( vips_object_sanity( VIPS_OBJECT( region ) ) );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user