gdbus-codegen: gracefully handle property get on proxy with no cached property
authorDavid Zeuthen <davidz@redhat.com>
Fri, 6 May 2011 14:32:42 +0000 (10:32 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Fri, 6 May 2011 14:32:42 +0000 (10:32 -0400)
commitf773bd8b764232d6c691de1329a2defc66c0e51f
tree3fc115494f63ae625b6c47954ea3b324aeba7ea9
parent3d3659c1b6b5cd65595e8b28b77f00ef58456dbd
gdbus-codegen: gracefully handle property get on proxy with no cached property

This can easily happen if the owner of the remote object vanishes. Of
course, when that happens, user code is already notified (by e.g. the
notify::g-name-owner signal) so it can avoid using the proxy but
requiring that is a bit harsh. IOW, before this patch this critical
error was printed

 GLib-GIO-CRITICAL **: g_dbus_gvariant_to_gvalue: assertion `value != NULL' failed

when that happened. With this patch, we just avoid setting the GValue
so the user will get the default value for its type instead. So, for
example, if the user code is getting a GVariant property on such a
defunct proxy, then he gets a NULL back. So unless said user code
checks the return value, criticals will still be printed if the NULL
GVariant is used for anything interesting.

Signed-off-by: David Zeuthen <davidz@redhat.com>
gio/gdbus-codegen/codegen.py