diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2008-02-13 20:30:17 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2008-02-13 20:30:17 +0000 |
commit | 2607f1d4f43019d5739a9391f96f271272039229 (patch) | |
tree | b0b8841eb7b61f91e845d6afc7d194a08efcaad6 /tools/glib-client-gen.py | |
parent | 66f92a412bd39a97f5af3f59b854cd516c10c4e1 (diff) |
glib-client-gen: special-case G_TYPE_VALUE outputs, fixing a crash when a method returns a variant
Diffstat (limited to 'tools/glib-client-gen.py')
-rw-r--r-- | tools/glib-client-gen.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py index 590e52046..89af95092 100644 --- a/tools/glib-client-gen.py +++ b/tools/glib-client-gen.py @@ -463,7 +463,13 @@ class Generator(object): name, info, tp_type, elt = arg ctype, gtype, marshaller, pointer = info - self.b(' %s%s;' % (ctype, name)) + # "We handle variants specially; the caller is expected to + # have already allocated storage for them". Thanks, + # dbus-glib... + if gtype == 'G_TYPE_VALUE': + self.b(' GValue *%s = g_new0 (GValue, 1);' % name) + else: + self.b(' %s%s;' % (ctype, name)) self.b('') self.b(' dbus_g_proxy_end_call (proxy, call, &error,') @@ -472,7 +478,10 @@ class Generator(object): name, info, tp_type, elt = arg ctype, gtype, marshaller, pointer = info - self.b(' %s, &%s,' % (gtype, name)) + if gtype == 'G_TYPE_VALUE': + self.b(' %s, %s,' % (gtype, name)) + else: + self.b(' %s, &%s,' % (gtype, name)) self.b(' G_TYPE_INVALID);') @@ -485,6 +494,13 @@ class Generator(object): self.b(' {') self.b(' tp_proxy_pending_call_v0_take_results (user_data, error,') self.b(' NULL);') + + for arg in out_args: + name, info, tp_type, elt = arg + ctype, gtype, marshaller, pointer = info + if gtype == 'G_TYPE_VALUE': + self.b(' g_free (%s);' % name) + self.b(' return;') self.b(' }') self.b('') |