From c8fc3e6c852c651c30c22c9375e484154ead0983 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 31 Mar 2011 18:04:23 +0100 Subject: [PATCH] fix a progress crash progress was not always being signalled on the right image in sink.c --- libvips/iofuncs/image.c | 4 ++++ libvips/iofuncs/sink.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index 2670b148..85de6394 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -1306,6 +1306,8 @@ vips_progress_add( VipsImage *image ) { VipsProgress *progress; + VIPS_DEBUG_MSG( "vips_progress_add: %p\n", image ); + if( !(progress = image->time) ) { if( !(image->time = VIPS_NEW( NULL, VipsProgress )) ) return( -1 ); @@ -1333,6 +1335,8 @@ vips_progress_update( VipsProgress *progress, int w, int h ) { float prop; + VIPS_DEBUG_MSG( "vips_progress_update: %p\n", progress ); + g_assert( progress ); progress->run = g_timer_elapsed( progress->start, NULL ); diff --git a/libvips/iofuncs/sink.c b/libvips/iofuncs/sink.c index b7aa4e4b..a68fc5c0 100644 --- a/libvips/iofuncs/sink.c +++ b/libvips/iofuncs/sink.c @@ -357,7 +357,10 @@ vips_sink_tile( VipsImage *im, sink.sink_base.tile_height = tile_height; } - vips_image_preeval( sink.t ); + /* vips_sink_base_progress() signals progress on im, so we have to do + * pre/post on that too. + */ + vips_image_preeval( im ); result = vips_threadpool_run( im, sink_thread_state_new, @@ -366,7 +369,7 @@ vips_sink_tile( VipsImage *im, vips_sink_base_progress, &sink ); - vips_image_posteval( sink.t ); + vips_image_posteval( im ); sink_free( &sink );