GNOME Bugzilla – Bug 695877
online-accounts: Small cleanup about resource releasing
Last modified: 2013-04-03 14:12:04 UTC
Use g_clear_object() as a NULL-safe g_object_unref() and g_list_free_full() instead of explicitly iterating the list contents. I'm less sure about the following change: - if (priv->error != NULL) - g_error_free (priv->error); + g_clear_pointer (&priv->error, g_error_free); I prefer g_clear_pointer() but it has worse performance because it guarantees atomic behaviour by taking a lock. OTOH it's not a performance critical path and I'd rather optimize for legibility with such negligible performance loss.
Created attachment 238924 [details] [review] online-accounts: Small cleanup about resource releasing Use g_clear_object() as a NULL-safe g_object_unref() and g_list_free_full() instead of explicitly iterating the list contents.
Drive-by comment: (In reply to comment #0) > I'm less sure about the following change: > - if (priv->error != NULL) > - g_error_free (priv->error); > + g_clear_pointer (&priv->error, g_error_free); glib also has g_clear_error()
Created attachment 238944 [details] [review] online-accounts: Small cleanup about resource releasing Use g_clear_error() as it is shorter and clears any doubt as it doesn't take any lock.
Review of attachment 238944 [details] [review]: Looks good.
The following fix has been pushed: 397181e online-accounts: Small cleanup about resource releasing
Created attachment 240477 [details] [review] online-accounts: Small cleanup about resource releasing Use g_clear_object() as a NULL-safe g_object_unref() and g_list_free_full() instead of explicitly iterating the list contents.