[evolution-ews/gnome-3-22] Runtime warnings when calling ResolveNames



commit d0fc40b3e42c4ea18b6461abb2c1ea739b93b537
Author: Milan Crha <mcrha redhat com>
Date:   Mon Oct 24 22:40:53 2016 +0200

    Runtime warnings when calling ResolveNames
    
    It can be that the ResolveNames response contain only mailboxes, but
    no contacts, for which is a comment written in the code, but the code
    doesn't reflect it and can cause runtime warnings when the contacts
    are not returned by the server.

 src/addressbook/e-book-backend-ews.c |    2 +-
 src/server/e-ews-connection.c        |   14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index ba4505e..89da81a 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -3528,7 +3528,7 @@ e_book_backend_ews_start_view (EBookBackend *backend,
        }
 
        g_slist_free_full (mailboxes, (GDestroyNotify) e_ews_mailbox_free);
-       g_slist_free_full (contacts, g_object_unref);
+       e_util_free_nullable_object_slist (contacts);
  out:
        e_data_book_view_notify_complete (book_view, error);
        g_clear_error (&error);
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index d3b5665..f44d672 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -1266,8 +1266,12 @@ ews_handle_resolution_set_param (ESoapParameter *subparam,
                        /* 'mailboxes' and 'contact_items' match 1:1, but if the contact information
                         * wasn't found, then NULL is stored in the corresponding position */
                        node = e_soap_parameter_get_first_child_by_name (subparam, "Contact");
-                       contact_item = e_ews_item_new_from_soap_parameter (node);
-                       contact_items = g_slist_prepend (contact_items, contact_item);
+                       if (node) {
+                               contact_item = e_ews_item_new_from_soap_parameter (node);
+                               contact_items = g_slist_prepend (contact_items, contact_item);
+                       } else {
+                               contact_items = g_slist_prepend (contact_items, NULL);
+                       }
                }
        }
 
@@ -5201,7 +5205,7 @@ e_ews_connection_resolve_names_finish (EEwsConnection *cnc,
        if (contact_items)
                *contact_items = async_data->items_created;
        else
-               g_slist_free_full (async_data->items_created, g_object_unref);
+               e_util_free_nullable_object_slist (async_data->items_created);
        *mailboxes = async_data->items;
 
        return TRUE;
@@ -5332,7 +5336,7 @@ ews_connection_resolve_by_name (EEwsConnection *cnc,
        }
 
        g_slist_free_full (mailboxes, (GDestroyNotify) e_ews_mailbox_free);
-       g_slist_free_full (contacts, g_object_unref);
+       e_util_free_nullable_object_slist (contacts);
 }
 
 gboolean
@@ -5387,7 +5391,7 @@ e_ews_connection_ex_to_smtp_sync (EEwsConnection *cnc,
        }
 
        g_slist_free_full (mailboxes, (GDestroyNotify) e_ews_mailbox_free);
-       g_slist_free_full (contacts, g_object_unref);
+       e_util_free_nullable_object_slist (contacts);
 
        if (!*smtp_address) {
                const gchar *usename;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]