lock on area tracking
This commit is contained in:
parent
8e85c3d0df
commit
1ef32179da
@ -37,9 +37,9 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
#define VIPS_DEBUG
|
||||
#define DEBUG
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
@ -150,7 +150,7 @@ vips_area_copy( VipsArea *area )
|
||||
{
|
||||
g_mutex_lock( area->lock );
|
||||
|
||||
g_assert( area->count >= 0 );
|
||||
g_assert( area->count > 0 );
|
||||
|
||||
area->count += 1;
|
||||
|
||||
@ -192,12 +192,17 @@ vips_area_unref( VipsArea *area )
|
||||
|
||||
g_free( area );
|
||||
|
||||
if( vips__leak )
|
||||
if( vips__leak ) {
|
||||
g_mutex_lock( vips__global_lock );
|
||||
vips_area_all = g_slist_remove( vips_area_all, area );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
g_mutex_lock( vips__global_lock );
|
||||
printf( "vips_area_unref: free .. total = %d\n",
|
||||
g_slist_length( vips_area_all ) );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
#endif /*DEBUG*/
|
||||
}
|
||||
else
|
||||
@ -230,13 +235,18 @@ vips_area_new( VipsCallbackFn free_fn, void *data )
|
||||
area->type = 0;
|
||||
area->sizeof_type = 0;
|
||||
|
||||
if( vips__leak )
|
||||
if( vips__leak ) {
|
||||
g_mutex_lock( vips__global_lock );
|
||||
vips_area_all = g_slist_prepend( vips_area_all, area );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
g_mutex_lock( vips__global_lock );
|
||||
printf( "vips_area_new: %p count = %d (%d in total)\n",
|
||||
area, area->count,
|
||||
g_slist_length( vips_area_all ) );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
return( area );
|
||||
|
Loading…
Reference in New Issue
Block a user