fix a progress crash

progress was not always being signalled on the right image in sink.c
This commit is contained in:
John Cupitt 2011-03-31 18:04:23 +01:00
parent db41b6ac4e
commit c8fc3e6c85
2 changed files with 9 additions and 2 deletions

View File

@ -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 );

View File

@ -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 );