summaryrefslogtreecommitdiff
path: root/tools/glib-client-gen.py
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2008-04-22 10:36:51 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2008-04-22 10:36:51 +0000
commitffe05ee484af99774ae3a48e8e8e2e8efe0bee0f (patch)
tree757219d7ba640b402d17bcea26ef8a5dbd8c7495 /tools/glib-client-gen.py
parentbea453aed6c360bd3e89b472ccc9bade238f4bfc (diff)
downloadtelepathy-glib-ffe05ee484af99774ae3a48e8e8e2e8efe0bee0f.tar.gz
glib-client-gen.py: in _call_ methods, destroy (user_data) even if there is no such interface (closes fd.o #15530).
If callback is NULL, require user_data, weak_object and destroy to be NULL too. 20080422103651-53eee-49e0b6c2c04ea90dbb8120d98808a7cc8f6b8a69.gz
Diffstat (limited to 'tools/glib-client-gen.py')
-rw-r--r--tools/glib-client-gen.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py
index aca3cceb7..feb303aaf 100644
--- a/tools/glib-client-gen.py
+++ b/tools/glib-client-gen.py
@@ -660,13 +660,18 @@ class Generator(object):
self.b(' * @%s: Used to pass an \'in\' argument: %s'
% (name, xml_escape(get_docstring(elt) or '(Undocumented)')))
- self.b(' * @callback: called when the method call succeeds or fails')
- self.b(' * @user_data: user-supplied data passed to the callback')
+ self.b(' * @callback: called when the method call succeeds or fails;')
+ self.b(' * may be %NULL to make a "fire and forget" call with no ')
+ self.b(' * reply tracking')
+ self.b(' * @user_data: user-supplied data passed to the callback;')
+ self.b(' * must be %NULL if @callback is %NULL')
self.b(' * @destroy: called with the user_data as argument, after the')
- self.b(' * call has succeeded, failed or been cancelled')
- self.b(' * @weak_object: A #GObject which will be weakly referenced; ')
- self.b(' * if it is destroyed, this callback will automatically be')
- self.b(' * disconnected')
+ self.b(' * call has succeeded, failed or been cancelled;')
+ self.b(' * must be %NULL if @callback is %NULL')
+ self.b(' * @weak_object: If not %NULL, a #GObject which will be ')
+ self.b(' * weakly referenced; if it is destroyed, this call ')
+ self.b(' * will automatically be cancelled. Must be %NULL if ')
+ self.b(' * @callback is %NULL')
self.b(' *')
self.b(' * Start a %s method call.' % member)
self.b(' *')
@@ -707,6 +712,12 @@ class Generator(object):
self.b('')
self.b(' g_return_val_if_fail (%s (proxy), NULL);'
% self.proxy_assert)
+ self.b(' g_return_val_if_fail (callback != NULL || '
+ 'user_data == NULL, NULL);')
+ self.b(' g_return_val_if_fail (callback != NULL || '
+ 'destroy == NULL, NULL);')
+ self.b(' g_return_val_if_fail (callback != NULL || '
+ 'weak_object == NULL, NULL);')
self.b('')
self.b(' iface = tp_proxy_borrow_interface_by_id (')
self.b(' (TpProxy *) proxy,')
@@ -727,6 +738,10 @@ class Generator(object):
self.b(' 0,')
self.b(' error, user_data, weak_object);')
+ self.b('')
+ self.b(' if (destroy != NULL)')
+ self.b(' destroy (user_data);')
+ self.b('')
self.b(' g_error_free (error);')
self.b(' return NULL;')
self.b(' }')