* leak fixes; free both list and its elements when we call modest_account_mgr_account...
[modest] / src / maemo / modest-address-book.c
index abf876d..eccf77f 100644 (file)
@@ -132,16 +132,19 @@ modest_address_book_add_address (const gchar *address)
        }
        
        account = osso_abook_account_get (EVC_EMAIL, NULL, address);
-       dialog = osso_abook_add_to_contacts_dialog_new (contact_model, account);
-       g_object_unref (account);
-       gtk_dialog_run (GTK_DIALOG (dialog));
+       if (account)
+       {
+               dialog = osso_abook_add_to_contacts_dialog_new (contact_model, account);
+               g_object_unref (account);
+               gtk_dialog_run (GTK_DIALOG (dialog));
 
-       if (contact_model) {
-               g_object_unref (contact_model);
-               contact_model = NULL;
-       }
+               if (contact_model) {
+                       g_object_unref (contact_model);
+                       contact_model = NULL;
+               }
 
-       gtk_widget_destroy (dialog);
+               gtk_widget_destroy (dialog);
+       }
 
 }
 
@@ -161,7 +164,7 @@ modest_address_book_select_addresses (ModestRecptEditor *recpt_editor)
        toplevel = gtk_widget_get_toplevel (GTK_WIDGET (recpt_editor));
 
        contact_model = osso_abook_contact_model_new ();
-       if (!open_addressbook ()) {
+       if (!open_addressbook_sync ()) {
                if (contact_model) {
                        g_object_unref (contact_model);
                        contact_model = NULL;
@@ -600,7 +603,7 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor)
                if (!modest_text_utils_validate_recipient (address)) {
                        if (strstr (address, "@") == NULL) {
                                /* here goes searching in addressbook */
-                               gchar *contact_id = NULL;;
+                               gchar *contact_id = NULL;
                                GSList *resolved_addresses = NULL;
                                result = resolve_address (address, &resolved_addresses, &contact_id);