return default value for unset props

we used to issue a warning and return early, but this can leave garbage
in the *value pointer, I think

ruby gobject-introspection will walk object props during GC and can see
state inbetween init and build when not all objects have been given a
value ... we don't want these warnings
This commit is contained in:
John Cupitt 2015-10-16 14:50:44 +01:00
parent faf7b70e2e
commit 64d081e726
3 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,6 @@
7/10/15 started 8.2.0
- added im_bufmagick2vips(), a vips7 wrapper for magick load from buffer
- fetch unset property now returns default value rather than warning
7/5/15 started 8.1.1
- oop, vips-8.0 should be vips-8.1, thanks Danilo

View File

@ -9,11 +9,7 @@
<bookinfo>
<title>VIPS Reference Manual</title>
<releaseinfo>
<<<<<<< HEAD
For VIPS 8.2.0.
=======
For VIPS 8.1.1.
>>>>>>> 8.1
The latest version of this documentation can be found on the
<ulink role="online-location"
url="http://www.vips.ecs.soton.ac.uk/index.php?title=Documentation">VIPS website</ulink>.

View File

@ -1315,11 +1315,12 @@ vips_object_get_property( GObject *gobject,
g_assert( ((VipsArgument *) argument_class)->pspec == pspec );
if( !argument_instance->assigned ) {
g_warning( "%s: %s.%s attempt to read unset %s property",
G_STRLOC,
G_OBJECT_TYPE_NAME( gobject ),
g_param_spec_get_name( pspec ),
g_type_name( G_PARAM_SPEC_VALUE_TYPE( pspec ) ) );
/* Set the value to the default. Things like Ruby
* gobject-introspection will walk objects during GC, and we
* can find ourselves fetching object vaklues between init and
* build.
*/
g_param_value_set_default( pspec, value );
return;
}