[evolution-data-server] Bug #648736 - Crash when adding default vcard for newly created DB



commit 9fc9cabef1a9732b538f6406656fce491d57fca6
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri May 27 14:01:18 2011 +0200

    Bug #648736 - Crash when adding default vcard for newly created DB

 addressbook/backends/file/e-book-backend-file.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index 1b09182..5274cbb 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -908,6 +908,10 @@ e_book_backend_file_open (EBookBackendSync       *backend,
 	time_t db_mtime;
 	struct stat sb;
 
+#ifdef CREATE_DEFAULT_VCARD
+	gboolean create_default_vcard = FALSE;
+#endif
+
 	dirname = e_book_backend_file_extract_path_from_source (source);
 	filename = g_build_filename (dirname, "addressbook.db", NULL);
 
@@ -1055,12 +1059,7 @@ e_book_backend_file_open (EBookBackendSync       *backend,
 			}
 			else {
 #ifdef CREATE_DEFAULT_VCARD
-				EContact *contact = NULL;
-
-				if (!do_create (bf, XIMIAN_VCARD, &contact, NULL))
-					g_warning ("Cannot create default contact");
-				if (contact)
-					g_object_unref (contact);
+				create_default_vcard = TRUE;
 #endif
 
 				readonly = FALSE;
@@ -1078,6 +1077,17 @@ e_book_backend_file_open (EBookBackendSync       *backend,
 		return;
 	}
 
+#ifdef CREATE_DEFAULT_VCARD
+	if (create_default_vcard) {
+		EContact *contact = NULL;
+
+		if (!do_create (bf, XIMIAN_VCARD, &contact, NULL))
+			g_warning ("Cannot create default contact");
+		if (contact)
+			g_object_unref (contact);
+	}
+#endif
+
 	if (!e_book_backend_file_maybe_upgrade_db (bf)) {
 		db->close (db, 0);
 		bf->priv->file_db = NULL;



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