fix a race in buffer.c

This commit is contained in:
John Cupitt 2014-01-07 21:31:00 +00:00
parent 3dcf138fc4
commit cc8e06db0b
2 changed files with 4 additions and 11 deletions

9
TODO
View File

@ -1,13 +1,4 @@
- try:
time vips dzsave JP2K-33003-1.svs x --layout zoomify
VIPS:ERROR:buffer.c:390:vips_buffer_new: assertion failed: (!buffer->cache)
Aborted (core dumped)
- new_heart.ws fails with libvips master
has the sharing fix resolved this?

View File

@ -262,10 +262,10 @@ vips_buffer_done( VipsBuffer *buffer )
g_assert( !g_slist_find( cache->buffers, buffer ) );
g_assert( !buffer->cache );
cache->buffers = g_slist_prepend( cache->buffers, buffer );
buffer->done = TRUE;
buffer->cache = cache;
cache->buffers = g_slist_prepend( cache->buffers, buffer );
}
}
@ -333,6 +333,8 @@ vips_buffer_unref( VipsBuffer *buffer )
/* Place on this thread's reserve list for reuse.
*/
if( cache->n_reserve < buffer_cache_max_reserve ) {
g_assert( !buffer->cache );
cache->reserve =
g_slist_prepend( cache->reserve, buffer );
cache->n_reserve += 1;