eds/tracker: Ensure the PersonaStores are removed on error
authorPhilip Withnall <philip@tecnocode.co.uk>
Fri, 2 Sep 2011 20:15:08 +0000 (21:15 +0100)
committerPhilip Withnall <philip@tecnocode.co.uk>
Fri, 2 Sep 2011 20:15:08 +0000 (21:15 +0100)
backends/eds/lib/edsf-persona-store.vala
backends/tracker/lib/trf-persona-store.vala

index e256740..83e0c29 100644 (file)
@@ -505,6 +505,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
             }
           catch (GLib.Error e1)
             {
+              /* Remove the persona store on error */
+              this.removed ();
+
               if (e1.domain == BookClient.error_quark ())
                 {
                   switch ((BookClientError) e1.code)
@@ -572,6 +575,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
 
           if (this._addressbook.is_opened () == false)
             {
+              /* Remove the persona store on error */
+              this.removed ();
+
               throw new PersonaStoreError.INVALID_ARGUMENT (
                   /* Translators: the parameter is an address book URI. */
                   _("Couldn't open address book ā€˜%sā€™."), this.id);
@@ -596,6 +602,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
             }
           catch (GLib.Error e2)
             {
+              /* Remove the persona store on error */
+              this.removed ();
+
               throw new PersonaStoreError.INVALID_ARGUMENT (
                   /* Translators: the parameteter is an error message. */
                   _("Couldn't get address book capabilities: %s"), e2.message);
@@ -623,6 +632,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
             }
           catch (GLib.Error e3)
             {
+              /* Remove the persona store on error */
+              this.removed ();
+
               if (e3.domain == BookClient.error_quark ())
                 {
                   switch ((BookClientError) e3.code)
index 3d44425..598b9a2 100644 (file)
@@ -1076,18 +1076,21 @@ public class Trf.PersonaStore : Folks.PersonaStore
                 {
                   warning ("Could not connect to D-Bus service: %s",
                            e1.message);
+                  this.removed ();
                   throw new PersonaStoreError.INVALID_ARGUMENT (e1.message);
                 }
               catch (Tracker.Sparql.Error e2)
                 {
                   warning ("Error fetching SPARQL connection handler: %s",
                            e2.message);
+                  this.removed ();
                   throw new PersonaStoreError.INVALID_ARGUMENT (e2.message);
                 }
               catch (GLib.DBusError e3)
                 {
                   warning ("Could not connect to D-Bus service: %s",
                            e3.message);
+                  this.removed ();
                   throw new PersonaStoreError.INVALID_ARGUMENT (e3.message);
                 }
             }