diff --git a/TODO b/TODO index e9b70ff2..ad3d3c91 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,20 @@ -- debug.c can go? +- rewind is not removing arg instance flags - make sanity a method on object + VIPS-WARNING **: object.c:567: VipsImage can only assign 'nickname' once - tools/others/sines.c and friends can go + VipsArgumentInstance *argument_instance = + vips__argument_get_instance( argument_class, object ); + + how do we find and junk these? + + vips_object_dispose_argument( + + runs, but perhaps does not trash instance storage? where is this released? + + + + +- tools/others/sines.c and friends can go - why not rename VipsBandFormat as VipsFormat? cf. VipsCoding, diff --git a/libvips/include/vips/object.h b/libvips/include/vips/object.h index 949970ab..940de6ce 100644 --- a/libvips/include/vips/object.h +++ b/libvips/include/vips/object.h @@ -292,6 +292,8 @@ void vips_object_local_cb( VipsObject *vobject, GObject *gobject ); void vips_object_print_all( void ); void vips_object_sanity_all( void ); +void vips_object_rewind( VipsObject *object ); + #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/iofuncs/check.c b/libvips/iofuncs/check.c index 8027d2a8..5d8a912b 100644 --- a/libvips/iofuncs/check.c +++ b/libvips/iofuncs/check.c @@ -235,7 +235,7 @@ im_incheck( IMAGE *im ) /* Free any resources the image holds and reset to a base * state. */ - g_object_run_dispose( G_OBJECT( im ) ); + vips_object_rewind( VIPS_OBJECT( im ) ); /* And reopen .. recurse to get a mmaped image. */ @@ -456,7 +456,7 @@ im_pincheck( IMAGE *im ) /* Free any resources the image holds and reset to a base * state. */ - g_object_run_dispose( G_OBJECT( im ) ); + vips_object_rewind( VIPS_OBJECT( im ) ); g_object_set( im, "mode", "r", diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index dc6dd8f3..dc765b5b 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -1244,3 +1244,18 @@ vips_object_sanity_all( void ) { vips_object_map( (VSListMap2Fn) vips_object_sanity_all_cb, NULL, NULL ); } + +/* On a rewind, we dispose the old contents of the object and + * reconstruct. This is used in things like im_pincheck() where a "w" + * image has to be rewound and become a "p" image. + */ +void +vips_object_rewind( VipsObject *object ) +{ + g_object_run_dispose( G_OBJECT( object ) ); + + object->constructed = FALSE; + object->preclose = FALSE; + object->close = FALSE; + object->postclose = FALSE; +}