<commit_before>=== modified file 'addressbook/libebook-dbus/e-book.c'
--- addressbook/libebook-dbus/e-book.c	2007-06-27 10:44:51 +0000
+++ addressbook/libebook-dbus/e-book.c	2007-06-28 15:01:58 +0000
@@ -1338,9 +1338,10 @@
 e_book_get_book_view (EBook *book, EBookQuery *query, GList *requested_fields, int max_results, EBookView **book_view, GError **error)
 {
   GError *err = NULL;
+  DBusGConnection *view_conn;
   DBusGProxy *view_proxy;
   char **fields;
-  char *sexp, *view_path;
+  char *sexp, *address;
 
   e_return_error_if_fail (E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
   e_return_error_if_fail (book->priv->proxy, E_BOOK_ERROR_REPOSITORY_OFFLINE);
@@ -1349,41 +1350,80 @@
 
   sexp = e_book_query_to_string (query);
   
-  if (!org_gnome_evolution_dataserver_addressbook_Book_get_book_view (book->priv->proxy, sexp, (const char **) fields, max_results, &view_path, &err)) {
+  if (!org_gnome_evolution_dataserver_addressbook_Book_get_book_view (book->priv->proxy, sexp, (const char **) fields, max_results, &address, &err)) {
     *book_view = NULL;
+    g_free (fields);
     g_free (sexp);
     return unwrap_gerror (err, error);
   }
-  view_proxy = dbus_g_proxy_new_for_name_owner (connection,
-                                                E_DATA_BOOK_FACTORY_SERVICE_NAME, view_path,
-                                                "org.gnome.evolution.dataserver.addressbook.BookView", error);
-  /* TODO: handle failures properly here too */
+  g_free (fields);
+  g_free (sexp);
+
+  view_conn = dbus_g_connection_open (address, &err);
+  g_free (address);
+  if (!view_conn) {
+    return unwrap_gerror (err, error);
+  }
+
+  view_proxy = dbus_g_proxy_new_for_peer (view_conn, "/", "org.gnome.evolution.dataserver.addressbook.BookView");
+  dbus_g_connection_unref (view_conn);
   if (!view_proxy) {
     *book_view = NULL;
+    g_set_error (error, E_BOOK_ERROR,
+                 E_BOOK_ERROR_CORBA_EXCEPTION,
+                 "Cannot open connection to book view");
+    return FALSE;
   } else {
     *book_view = e_book_view_new (book, view_proxy);
+    return TRUE;
   }
-  g_free (view_path);
-  g_free (sexp);
-  g_free (fields);
-  return TRUE;
 }
 
 static void
-get_book_view_reply (DBusGProxy *proxy, char *view_path, GError *error, gpointer user_data)
+get_book_view_reply (DBusGProxy *proxy, char *address, GError *error, gpointer user_data)
 {
   struct async_data *data = user_data;
+  GError *err = NULL;
   EBookView *view;
   EBookBookViewCallback cb = data->callback;
+  DBusGConnection *view_conn;
   DBusGProxy *view_proxy;
 
-  view_proxy = dbus_g_proxy_new_for_name_owner (connection, E_DATA_BOOK_FACTORY_SERVICE_NAME, view_path,
-                                           "org.gnome.evolution.dataserver.addressbook.BookView", NULL);
-  /* TODO: handle errors */
+  if (error) {
+    if (cb)
+      cb (data->book, get_status_from_error (error), NULL, data->closure);
+    g_error_free (error);
+    g_free (data);
+    return;
+  }
+  
+  
+  view_conn = dbus_g_connection_open (address, &err);
+  if (!view_conn) {
+    g_warning (G_STRLOC ": cannot get connection: %s", err->message);<commit_msg>Fix leak of address (#71061)<commit_after>=== modified file 'addressbook/libebook-dbus/e-book.c'
--- addressbook/libebook-dbus/e-book.c	2007-06-27 10:44:51 +0000
+++ addressbook/libebook-dbus/e-book.c	2007-06-28 15:01:58 +0000
@@ -1338,9 +1338,10 @@
 e_book_get_book_view (EBook *book, EBookQuery *query, GList *requested_fields, int max_results, EBookView **book_view, GError **error)
 {
   GError *err = NULL;
+  DBusGConnection *view_conn;
   DBusGProxy *view_proxy;
   char **fields;
-  char *sexp, *view_path;
+  char *sexp, *address;
 
   e_return_error_if_fail (E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
   e_return_error_if_fail (book->priv->proxy, E_BOOK_ERROR_REPOSITORY_OFFLINE);
@@ -1349,41 +1350,82 @@
 
   sexp = e_book_query_to_string (query);
   
-  if (!org_gnome_evolution_dataserver_addressbook_Book_get_book_view (book->priv->proxy, sexp, (const char **) fields, max_results, &view_path, &err)) {
+  if (!org_gnome_evolution_dataserver_addressbook_Book_get_book_view (book->priv->proxy, sexp, (const char **) fields, max_results, &address, &err)) {
     *book_view = NULL;
+    g_free (fields);
     g_free (sexp);
     return unwrap_gerror (err, error);
   }
-  view_proxy = dbus_g_proxy_new_for_name_owner (connection,
-                                                E_DATA_BOOK_FACTORY_SERVICE_NAME, view_path,
-                                                "org.gnome.evolution.dataserver.addressbook.BookView", error);
-  /* TODO: handle failures properly here too */
+  g_free (fields);
+  g_free (sexp);
+
+  view_conn = dbus_g_connection_open (address, &err);
+  g_free (address);
+  if (!view_conn) {
+    return unwrap_gerror (err, error);
+  }
+
+  view_proxy = dbus_g_proxy_new_for_peer (view_conn, "/", "org.gnome.evolution.dataserver.addressbook.BookView");
+  dbus_g_connection_unref (view_conn);
   if (!view_proxy) {
     *book_view = NULL;
+    g_set_error (error, E_BOOK_ERROR,
+                 E_BOOK_ERROR_CORBA_EXCEPTION,
+                 "Cannot open connection to book view");
+    return FALSE;
   } else {
     *book_view = e_book_view_new (book, view_proxy);
+    return TRUE;
   }
-  g_free (view_path);
-  g_free (sexp);
-  g_free (fields);
-  return TRUE;
 }
 
 static void
-get_book_view_reply (DBusGProxy *proxy, char *view_path, GError *error, gpointer user_data)
+get_book_view_reply (DBusGProxy *proxy, char *address, GError *error, gpointer user_data)
 {
   struct async_data *data = user_data;
+  GError *err = NULL;
   EBookView *view;
   EBookBookViewCallback cb = data->callback;
+  DBusGConnection *view_conn;
   DBusGProxy *view_proxy;
 
-  view_proxy = dbus_g_proxy_new_for_name_owner (connection, E_DATA_BOOK_FACTORY_SERVICE_NAME, view_path,
-                                           "org.gnome.evolution.dataserver.addressbook.BookView", NULL);
-  /* TODO: handle errors */
+  if (error) {
+    if (cb)
+      cb (data->book, get_status_from_error (error), NULL, data->closure);
+    g_error_free (error);
+    g_free (address);
+    g_free (data);
+    return;
+  }
+  
+  
+  view_conn = dbus_g_connection_open (address, &err);
+  g_free (address);
+  if (!view_conn) {
+    g_warning (G_STRLOC ": cannot get connection: %s", err->message);
{'fraction_non_alphanumeric': 0.1303529411764706, 'fraction_numerical': 0.019294117647058823, 'mean_word_length': 3.518781006378455, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6318089', 'n_tokens_mistral': 2464, 'n_tokens_neox': 2352, 'n_words': 459}