[gnome-online-accounts/gnome-3-20] goa_identity_manager_get_identity_finish should return a new ref
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/gnome-3-20] goa_identity_manager_get_identity_finish should return a new ref
- Date: Thu, 5 Jan 2017 09:54:58 +0000 (UTC)
commit 01882bde514aae12796c98e03818f8d30cbd13b9
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Aug 2 01:43:09 2016 +0200
goa_identity_manager_get_identity_finish should return a new ref
The vast majority, if not all, of *_finish functions out there transfer
ownership of the return value to the caller. This also matches with the
behaviour of new APIs like g_task_propagate_pointer. Therefore, let's
make this change for the sake of consistency and making it easier to
port to GTask.
https://bugzilla.gnome.org/show_bug.cgi?id=764157
src/goaidentity/goaidentityservice.c | 7 +++++--
src/goaidentity/goakerberosidentitymanager.c | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/goaidentity/goaidentityservice.c b/src/goaidentity/goaidentityservice.c
index 5f10f86..f6e21c8 100644
--- a/src/goaidentity/goaidentityservice.c
+++ b/src/goaidentity/goaidentityservice.c
@@ -476,7 +476,7 @@ on_got_identity_for_sign_out (GoaIdentityManager *manager,
GSimpleAsyncResult *operation_result)
{
GError *error;
- GoaIdentity *identity;
+ GoaIdentity *identity = NULL;
error = NULL;
identity = goa_identity_manager_get_identity_finish (manager, result, &error);
@@ -485,7 +485,7 @@ on_got_identity_for_sign_out (GoaIdentityManager *manager,
{
g_debug ("GoaIdentityService: Identity could not be signed out: %s",
error->message);
- return;
+ goto out;
}
g_object_set_data_full (G_OBJECT (operation_result),
@@ -500,6 +500,9 @@ on_got_identity_for_sign_out (GoaIdentityManager *manager,
(GAsyncReadyCallback)
on_identity_signed_out,
operation_result);
+
+ out:
+ g_clear_object (&identity);
}
static gboolean
diff --git a/src/goaidentity/goakerberosidentitymanager.c b/src/goaidentity/goakerberosidentitymanager.c
index c3645cc..016786d 100644
--- a/src/goaidentity/goakerberosidentitymanager.c
+++ b/src/goaidentity/goakerberosidentitymanager.c
@@ -1108,7 +1108,7 @@ goa_kerberos_identity_manager_get_identity_finish (GoaIdentityManager *self,
identity =
g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
- return identity;
+ return g_object_ref (identity);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]