Index: addressbook/libebook/e-book.c
===================================================================
--- addressbook/libebook/e-book.c	(revision 8106)
+++ addressbook/libebook/e-book.c	(working copy)
@@ -119,9 +119,6 @@
 } EBookLoadState;
 
 struct _EBookPrivate {
-	GList *book_factories;
-	GList *iter;
-
 	/* cached capabilites */
 	char *cap;
 	gboolean cap_queried;
@@ -3188,6 +3185,7 @@
 
 		CORBA_exception_free (&ev);
 
+		book->priv->corba_book = NULL;
 		e_book_listener_stop (book->priv->listener);
 		bonobo_object_unref (BONOBO_OBJECT (book->priv->listener));
 
@@ -4001,9 +3999,6 @@
 	EBook             *book = E_BOOK (object);
 
 	if (book->priv) {
-		CORBA_Environment  ev;
-		GList *l;
-
 		if (book->priv->comp_listener) {
 			g_signal_handler_disconnect (book->priv->comp_listener, book->priv->died_signal);
 			g_object_unref (book->priv->comp_listener);
@@ -4013,21 +4008,19 @@
 		if (book->priv->load_state == E_BOOK_SOURCE_LOADED)
 			e_book_unload_uri (book, NULL);
 
-		CORBA_exception_init (&ev);
+		if (book->priv->corba_book) {
+			CORBA_Environment  ev;
 
-		for (l = book->priv->book_factories; l; l = l->next) {
-			CORBA_Object_release ((CORBA_Object)l->data, &ev);
-			if (ev._major != CORBA_NO_EXCEPTION) {
-				g_warning ("EBook: Exception while releasing BookFactory\n");
-
-				CORBA_exception_free (&ev);
-				CORBA_exception_init (&ev);
-			}
+			CORBA_exception_init (&ev);
+			bonobo_object_release_unref  (book->priv->corba_book, &ev);
+			if (ev._major != CORBA_NO_EXCEPTION)
+				g_warning ("%s: Exception releasing remote book interface!\n", __FUNCTION__);
+			CORBA_exception_free (&ev);
 		}
-		
-		CORBA_exception_free (&ev);
 
 		if (book->priv->listener) {
+			e_book_listener_stop (book->priv->listener);
+
 			/* GLib bug compatibility */
 			if (g_signal_handler_is_connected (book->priv->listener, book->priv->listener_signal))
 				g_signal_handler_disconnect (book->priv->listener, book->priv->listener_signal);
Index: addressbook/ChangeLog
===================================================================
--- addressbook/ChangeLog	(revision 8106)
+++ addressbook/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2007-10-05  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #420167
+
+	* libebook/e-book.c: (e_book_unload_uri), (e_book_dispose):
+	Be sure we released corba_book and stopped listener.
+
 2007-10-03  Matthew Barnes  <mbarnes@redhat.com>
 
 	** Fixes part of bug #469657
Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 8106)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2007-10-05  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #420167
+
+	* backends/contacts/e-cal-backend-contacts.c: (contact_record_new),
+	(contact_record_free), (contact_record_cb_new):
+	Ref and Unref backend used in ContactRecord to be sure it isn't
+	freed before we endup with it.
+
 2007-10-03  Matthew Barnes  <mbarnes@redhat.com>
 
 	** Fixes part of bug #469657
Index: calendar/backends/contacts/e-cal-backend-contacts.c
===================================================================
--- calendar/backends/contacts/e-cal-backend-contacts.c	(revision 8106)
+++ calendar/backends/contacts/e-cal-backend-contacts.c	(working copy)
@@ -141,7 +141,7 @@
         ContactRecord *cr = g_new0 (ContactRecord, 1);
 	char *comp_str;
         
-        cr->cbc = cbc;
+        cr->cbc = g_object_ref (cbc);
         cr->contact = contact;
         cr->comp_birthday = create_birthday (cbc, contact);
         cr->comp_anniversary = create_anniversary (cbc, contact);
@@ -196,7 +196,8 @@
 		g_free (comp_str);
 		g_object_unref (G_OBJECT (cr->comp_anniversary));
 	}
-        
+
+	g_object_unref (cr->cbc);
         g_free (cr);
 }
 
@@ -212,7 +213,7 @@
 {
         ContactRecordCB *cb_data = g_new (ContactRecordCB, 1);
 
-        cb_data->cbc = cbc;
+        cb_data->cbc = g_object_ref (cbc);
         cb_data->sexp = sexp;
         cb_data->result = NULL;
 
