fix a refleak

This commit is contained in:
John Cupitt 2011-12-06 12:34:40 +00:00
parent e9e23536eb
commit 4367ccb177
2 changed files with 37 additions and 8 deletions

35
TODO
View File

@ -1,11 +1,38 @@
- try:
- do we need vips_object_unref_outputs() in more places? check all calls to
_build()
- how about
vips max add[babe.jpg,babe2.jpg]
does that make any sense?
vips copy add[babe.jpg,add[babe2.jpg,babe3.jpg]] sum.v
$ vips copy z.tif[page=12] babe.v
get a couple of leaked objects from the error
- make im_tiff2vips.c into a stub
- what should we do?
vips_image_new_from_file( "x.tif[page=12]" );
or maybe:
vips_image_new_from_file( "x.tif", "page", 12, NULL );
or maybe neither? we'd like this to work though:
header x.tif[page=12]
object_new_from_string()?
@ -20,8 +47,6 @@
- "header fred.png" does not work, since header uses im_open() which uses
VipsForeign
- "header x.tif[page=7]" does not work

View File

@ -1280,16 +1280,20 @@ vips_object_set_argument_from_string( VipsObject *object,
if( vips_cache_operation_build(
(VipsOperation **) &new_object ) ) {
/* The build may have made some output objects before
* failing.
*/
vips_object_unref_outputs( new_object );
g_object_unref( new_object );
return( -1 );
}
g_object_get( new_object, "out", &out, NULL );
/* Getting @out will have upped it's count and we want to
* hold the only ref to it.
/* Getting @out will have upped its count so it'll be safe.
* We can junk all other outputs,
*/
g_object_unref( out );
vips_object_unref_outputs( new_object );
/* @out holds a ref to new_object, we can drop ours.
*/