From fb73046e71f05c3fd1d48ffb8347b766a7bfe8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org> Date: Fri, 5 Jun 2020 13:33:27 +0200 Subject: [PATCH 1/2] calls-contacts: Document lookup_phone_number This makes sure we have clear ownership rules --- src/calls-contacts.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/calls-contacts.c b/src/calls-contacts.c index 936cd11d..36b1c855 100644 --- a/src/calls-contacts.c +++ b/src/calls-contacts.c @@ -164,7 +164,15 @@ search_view_prepare_cb (FolksSearchView *view, } } - +/* + * calls_contacts_lookup_phone_number: + * @self: The #CallsContact + * @number: The phonenumber + * + * Get a best contact match for a phone number + * + * Returns: (transfer none): The best match as #CallsBestMatch + */ CallsBestMatch * calls_contacts_lookup_phone_number (CallsContacts *self, EPhoneNumber *number) -- GitLab From 09cbdf41813fe3d0c778f3abf2154497e391b6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org> Date: Fri, 5 Jun 2020 13:45:50 +0200 Subject: [PATCH 2/2] calls-call-record-row: Ref the returned contact calls_contacts_lookup_phone_number is transfer-none --- src/calls-call-record-row.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calls-call-record-row.c b/src/calls-call-record-row.c index f0c83220..3e0495eb 100644 --- a/src/calls-call-record-row.c +++ b/src/calls-call-record-row.c @@ -381,6 +381,7 @@ setup_contact (CallsCallRecordRow *self) self->contact = calls_contacts_lookup_phone_number (self->contacts, phone_number); g_assert (self->contact != NULL); + g_object_ref (self->contact); g_clear_object (&self->contacts); e_phone_number_free (phone_number); -- GitLab