Deal with lingering callbacks in the eds/set-avatar test.
authorTravis Reitter <travis.reitter@collabora.co.uk>
Fri, 23 Sep 2011 00:00:41 +0000 (17:00 -0700)
committerTravis Reitter <travis.reitter@collabora.co.uk>
Fri, 23 Sep 2011 17:16:23 +0000 (10:16 -0700)
These can be called after we've set this._main_loop = null,
so if we don't check it first, we'll hit warnings (which get
treated as errors).

This isn't an ideal solution, but there doesn't seem to be a
great way to avoid the handlers from firing after we no
longer care (we need something like thaw/freeze_notify(),
except for general signals, not just notify).

tests/eds/set-avatar.vala

index 90e8b20..48876dd 100644 (file)
@@ -151,7 +151,11 @@ public class SetAvatarTests : Folks.TestCase
               if (TestUtils.loadable_icons_content_equal.end (result))
                 {
                   this._found_after_update = true;
-                  this._main_loop.quit ();
+
+                  /* we can reach this point multiple times, so we need to make
+                   * sure the main loop is still valid */
+                  if (this._main_loop != null)
+                    this._main_loop.quit ();
                 }
             });
         }
@@ -235,7 +239,11 @@ public class SetAvatarTests : Folks.TestCase
                                   this._check_individual_has_avatar.end (res)
                                       == true);
 
-                              this._main_loop.quit ();
+                              /* we can reach this point multiple times, so we
+                               * need to make sure the main loop is still valid
+                               */
+                              if (this._main_loop != null)
+                                this._main_loop.quit ();
                             });
                         }
                       catch (PropertyError e)