EdsTest.Backend: clear up more thoroughly after tests
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 19 Mar 2013 14:22:04 +0000 (14:22 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 20 Mar 2013 11:56:51 +0000 (11:56 +0000)
Bug https://bugzilla.gnome.org/show_bug.cgi?id=690830
Reviewed-by: Philip Withnall <philip@tecnocode.co.uk>
[redundant line removed in response to review -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
tests/lib/eds/backend.vala

index 56626ae..781c91b 100644 (file)
@@ -41,7 +41,7 @@ public class EdsTest.Backend
   private E.BookClient? _addressbook = null;
   private GLib.List<string> _e_contacts;
   private GLib.List<Gee.HashMap<string, Value?>> _contacts;
-  E.SourceRegistry _source_registry;
+  E.SourceRegistry? _source_registry = null;
   E.Source? _source = null;
   File? _source_file = null;
 
@@ -162,8 +162,9 @@ public class EdsTest.Backend
           "BackendName=local\n").printf (this._addressbook_name);
 
       /* Build a SourceRegistry to manage the sources. */
-      this._source_registry = yield create_source_registry (null);
-      var signal_id = this._source_registry.source_added.connect ((r, s) =>
+      var source_registry = yield create_source_registry (null);
+      this._source_registry = source_registry;
+      var signal_id = source_registry.source_added.connect ((r, s) =>
         {
           this._source = s;
           this._prepare_source_async.callback ();
@@ -172,7 +173,7 @@ public class EdsTest.Backend
       /* Perform the write and then wait for the SourceRegistry to notify. */
       yield source_file.replace_contents_async (source_file_content.data, null,
           false, FileCreateFlags.NONE, null, null);
-      this._source = this._source_registry.ref_source (this._addressbook_name);
+      this._source = source_registry.ref_source (this._addressbook_name);
       if (this._source == null)
         {
           yield;
@@ -180,7 +181,7 @@ public class EdsTest.Backend
 
       /* Sanity check then tidy up. */
       assert (this._source != null);
-      this._source_registry.disconnect (signal_id);
+      source_registry.disconnect (signal_id);
 
       this._source_file = source_file;
 
@@ -343,6 +344,7 @@ public class EdsTest.Backend
           this._source_file = null;
           this._source = null;
           this._addressbook = null;
+          this._source_registry = null;
         }
     }