From 45b6345e7fe2a0d9338cf300c7c869c7c8aa8ad6 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 31 May 2016 21:58:01 +0100 Subject: [PATCH] better stop on sinkdisc fail we were not always setting stop on allocate fail, could deadlock if (for example) flush failed --- libvips/iofuncs/sinkdisc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libvips/iofuncs/sinkdisc.c b/libvips/iofuncs/sinkdisc.c index f686d6fc..3abd0bb9 100644 --- a/libvips/iofuncs/sinkdisc.c +++ b/libvips/iofuncs/sinkdisc.c @@ -334,8 +334,10 @@ wbuffer_allocate_fn( VipsThreadState *state, void *a, gboolean *stop ) /* Block until the write of the previous buffer * is done, then set write of this buffer going. */ - if( wbuffer_flush( write ) ) + if( wbuffer_flush( write ) ) { + *stop = TRUE; return( -1 ); + } /* End of image? */ @@ -359,8 +361,10 @@ wbuffer_allocate_fn( VipsThreadState *state, void *a, gboolean *stop ) /* Position buf at the new y. */ if( wbuffer_position( write->buf, - sink_base->y, sink_base->nlines ) ) + sink_base->y, sink_base->nlines ) ) { + *stop = TRUE; return( -1 ); + } } }