remove atexit use

too unreliable to be useful
This commit is contained in:
John Cupitt 2022-02-17 14:30:02 +00:00
parent f6dafd6fc6
commit 01a9947006
3 changed files with 18 additions and 31 deletions

View File

@ -392,7 +392,7 @@ fi
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([getcwd gettimeofday getwd memset munmap putenv realpath strcasecmp strchr strcspn strdup strerror strrchr strspn vsnprintf realpath mkstemp mktemp random rand sysconf atexit _aligned_malloc posix_memalign memalign])
AC_CHECK_FUNCS([getcwd gettimeofday getwd memset munmap putenv realpath strcasecmp strchr strcspn strdup strerror strrchr strspn vsnprintf realpath mkstemp mktemp random rand sysconf _aligned_malloc posix_memalign memalign])
AC_CHECK_LIB(m,cbrt,[AC_DEFINE(HAVE_CBRT,1,[have cbrt() in libm.])])
AC_CHECK_LIB(m,hypot,[AC_DEFINE(HAVE_HYPOT,1,[have hypot() in libm.])])
AC_CHECK_LIB(m,atan2,[AC_DEFINE(HAVE_ATAN2,1,[have atan2() in libm.])])

View File

@ -418,30 +418,6 @@ vips_leak( void )
return( n_leaks );
}
/* This is not guaranteed to be called, and might be called after many parts
* of libvips have been freed. Threads can be in an indeterminate state.
* You must be very careful to avoid segvs.
*/
static void
vips__atexit( void )
{
/* In dev releases, always show leaks. But not more than once, it's
* annoying.
*/
#ifndef DEBUG_LEAK
if( vips__leak )
#endif /*DEBUG_LEAK*/
{
static gboolean done = FALSE;
if( !done ) {
done = TRUE;
vips_cache_drop_all();
vips_leak();
}
}
}
/**
* vips_init:
* @argv0: name of application
@ -658,10 +634,6 @@ vips_init( const char *argv0 )
gsf_init();
#endif /*HAVE_GSF*/
#ifdef HAVE_ATEXIT
atexit( vips__atexit );
#endif /*HAVE_ATEXIT*/
#ifdef DEBUG_LEAK
vips__image_pixels_quark =
g_quark_from_static_string( "vips-image-pixels" );
@ -750,11 +722,26 @@ void
vips_shutdown( void )
{
#ifdef DEBUG
printf( "vips_shutdown:\n" );
#endif /*DEBUG*/
printf( "vips_shutdown:\n" );
vips_cache_drop_all();
/* In dev releases, always show leaks. But not more than once, it's
* annoying.
*/
#ifndef DEBUG_LEAK
if( vips__leak )
#endif /*DEBUG_LEAK*/
{
static gboolean done = FALSE;
if( !done ) {
done = TRUE;
vips_leak();
}
}
#if ENABLE_DEPRECATED
im_close_plugins();
#endif

View File

@ -107,7 +107,7 @@ if cpp.compiles(vector_arithmetic_check, name: 'Has vector arithmetic', dependen
endif
endif
func_names = [ 'getcwd', 'gettimeofday', 'getwd', 'memset', 'munmap', 'putenv', 'realpath', 'strcasecmp', 'strchr', 'strcspn', 'strdup', 'strerror', 'strrchr', 'strspn', 'vsnprintf', 'realpath', 'mkstemp', 'mktemp', 'random', 'rand', 'sysconf', 'atexit', '_aligned_malloc', 'posix_memalign', 'memalign', 'cbrt', 'hypot', 'atan2', 'asinh' ]
func_names = [ 'getcwd', 'gettimeofday', 'getwd', 'memset', 'munmap', 'putenv', 'realpath', 'strcasecmp', 'strchr', 'strcspn', 'strdup', 'strerror', 'strrchr', 'strspn', 'vsnprintf', 'realpath', 'mkstemp', 'mktemp', 'random', 'rand', 'sysconf', '_aligned_malloc', 'posix_memalign', 'memalign', 'cbrt', 'hypot', 'atan2', 'asinh' ]
foreach func_name : func_names
if cc.has_function(func_name, dependencies: m_dep)
cfg_var.set('HAVE_' + func_name.to_upper(), '1')