summaryrefslogtreecommitdiff
path: root/telepathy-glib/connection-handles.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2008-10-07 17:19:06 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2008-10-13 12:57:36 +0100
commit5c262db71ab99276f963ba1764dffd98ba45507f (patch)
treeb3147ceb587ec78b8bb4c96eb4176b8337defc0d /telepathy-glib/connection-handles.c
parent90fc47a040242d1ada4f34c1ae3e44947ecafa5c (diff)
downloadtelepathy-glib-5c262db71ab99276f963ba1764dffd98ba45507f.tar.gz
tp_connection_hold_handles: add more checks, and do not allow holding 0 handles
Diffstat (limited to 'telepathy-glib/connection-handles.c')
-rw-r--r--telepathy-glib/connection-handles.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/telepathy-glib/connection-handles.c b/telepathy-glib/connection-handles.c
index 11cda5750..2909bba56 100644
--- a/telepathy-glib/connection-handles.c
+++ b/telepathy-glib/connection-handles.c
@@ -452,7 +452,7 @@ connection_held_handles (TpConnection *self,
* @self: a connection
* @timeout_ms: the timeout in milliseconds, or -1 to use the default
* @handle_type: the handle type
- * @n_handles: the number of handles in @handles
+ * @n_handles: the number of handles in @handles (must be at least 1)
* @handles: an array of handles
* @callback: called on success or failure (unless @weak_object has become
* unreferenced)
@@ -481,6 +481,12 @@ tp_connection_hold_handles (TpConnection *self,
{
HoldHandlesContext *context;
+ g_return_if_fail (TP_IS_CONNECTION (self));
+ g_return_if_fail (handle_type > TP_HANDLE_TYPE_NONE);
+ g_return_if_fail (handle_type < NUM_TP_HANDLE_TYPES);
+ g_return_if_fail (n_handles >= 1);
+ g_return_if_fail (callback != NULL);
+
context = g_slice_new0 (HoldHandlesContext);
context->handle_type = handle_type;
context->user_data = user_data;