exit() in fewer cases

we now only exit() when we know the stack has been trashed, just warn in
other cases
This commit is contained in:
John Cupitt 2014-07-29 15:23:27 +01:00
parent 2115c6d166
commit 0bb8a218bb
8 changed files with 32 additions and 6 deletions

View File

@ -1,6 +1,7 @@
25/7/14 started 7.40.5
- fix a race in im_maxpos_avg()
- limit n_thr on tiny images
- don't exit() on memleak detected, just warn
4/7/14 started 7.40.4
- fix vips_rawsave_fd(), thanks aferrero2707

2
TODO
View File

@ -8,6 +8,8 @@
- vipsthumbnail -t plus large -s seems to fail?
- bicubic adds noise to 255/255/255, why? try babe.jpg background
- vips_object_unref_outputs() needs docs ... bindings will need it

View File

@ -76,7 +76,7 @@ typedef struct _VipsBuildlut {
int xlow; /* Index 0 in output is this x */
int lut_size; /* Number of output elements to generate */
double **data; /* Matrix row pointers */
double *buf; /* Ouput buffer */
double *buf; /* Output buffer */
} VipsBuildlut;
typedef VipsCreateClass VipsBuildlutClass;

View File

@ -254,7 +254,7 @@ vips_invfft_class_init( VipsInvfftClass *class )
VIPS_ARG_BOOL( class, "real", 4,
_( "Real" ),
_( "Ouput only the real part of the transform" ),
_( "Output only the real part of the transform" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsInvfft, real ),
FALSE );

View File

@ -582,7 +582,10 @@ vips_buffer_print( VipsBuffer *buffer )
static void
vips__buffer_init_cb( VipsBufferThread *buffer_thread )
{
vips_error_exit( "vips_thread_shutdown() not called for thread %p",
/* This is a mem leak, not catastrophic.
*/
vips_warn( "VipsBuffer",
_( "vips_thread_shutdown() not called for thread %p" ),
g_thread_self() );
}

View File

@ -130,7 +130,9 @@ vips_thread_profile_save( VipsThreadProfile *profile )
vips__file_open_write( "vips-profile.txt", TRUE );
if( !vips__thread_fp ) {
g_mutex_unlock( vips__global_lock );
vips_error_exit( "unable to create profile log" );
vips_warn( "VipsGate",
"%s", "unable to create profile log" );
return;
}
printf( "recording profile in vips-profile.txt\n" );
@ -192,7 +194,8 @@ vips__thread_profile_init_cb( VipsThreadProfile *profile )
* We can't do the freeing in this callback since GPrivate has already
* stopped working.
*/
vips_error_exit( "vips_thread_shutdown() not called for thread %p",
vips_warn( "VipsBuffer",
_( "vips_thread_shutdown() not called for thread %p" ),
g_thread_self() );
}

View File

@ -419,6 +419,9 @@ vips_vsnprintf( char *str, size_t size, const char *format, va_list ap )
int n;
static char buf[MAX_BUF];
/* We can't return an error code, we may already have trashed the
* stack. We must stop immediately.
*/
if( size > MAX_BUF )
vips_error_exit( "panic: buffer overflow "
"(request to write %d bytes to buffer of %d bytes)",

View File

@ -234,7 +234,8 @@ vips_affine_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
VipsRect image, want, need, clipped;
#ifdef DEBUG
printf( "affine: generating left=%d, top=%d, width=%d, height=%d\n",
printf( "vips_affine_gen: "
"generating left=%d, top=%d, width=%d, height=%d\n",
r->left,
r->top,
r->width,
@ -430,6 +431,7 @@ vips_affine_build( VipsObject *object )
affine->trn.ody = 0;
vips__transform_set_area( &affine->trn );
if( vips_object_argument_isset( object, "oarea" ) ) {
affine->trn.oarea.left = ((int *) affine->oarea->data)[0];
affine->trn.oarea.top = ((int *) affine->oarea->data)[1];
@ -456,6 +458,9 @@ vips_affine_build( VipsObject *object )
affine->trn.oarea.width == in->Xsize &&
affine->trn.oarea.height == in->Ysize )
return( vips_image_write( in, resample->out ) );
/*
printf( "vips_affine_build: identity shortcut disabled\n" );
*/
/* Check for coordinate overflow ... we want to be able to hold the
* output space inside INT_MAX / TRANSFORM_SCALE.
@ -507,6 +512,15 @@ vips_affine_build( VipsObject *object )
affine->trn.d );
#endif /*DEBUG*/
#ifdef DEBUG
printf( "vips_affine_build: output area: "
"left = %d, top = %d, width = %d, height = %d\n",
affine->trn.oarea.left,
affine->trn.oarea.top,
affine->trn.oarea.width,
affine->trn.oarea.height );
#endif /*DEBUG*/
/* Generate!
*/
if( vips_image_generate( resample->out,