[folks] Deal with lingering callbacks in the eds/set-avatar test.



commit f7d6df3c2ee823196ce2900cc8d344e8e9d5f55c
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Thu Sep 22 17:00:41 2011 -0700

    Deal with lingering callbacks in the eds/set-avatar test.
    
    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 |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/tests/eds/set-avatar.vala b/tests/eds/set-avatar.vala
index 90e8b20..48876dd 100644
--- a/tests/eds/set-avatar.vala
+++ b/tests/eds/set-avatar.vala
@@ -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)



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