[folks] core: Add more debug output and validation to the IndividualAggregator
- From: Raul Gutierrez Segales <raulgs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] core: Add more debug output and validation to the IndividualAggregator
- Date: Wed, 7 Sep 2011 22:19:30 +0000 (UTC)
commit fa1fb9f4ab151268fd2eee16a1afe7c2f87e5f42
Author: Philip Withnall <philip tecnocode co uk>
Date: Tue Sep 6 22:10:20 2011 +0100
core: Add more debug output and validation to the IndividualAggregator
Everyone loves debug output, and validating that we aren't leaving stale
entries in the link map which will later cause whoever's looking into
aggregator bugs to hide in a corner and cry.
Helps: bgo#656689
folks/individual-aggregator.vala | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index bb8cfd9..8b89736 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -827,10 +827,11 @@ public class Folks.IndividualAggregator : Object
/* Create the final linked Individual */
final_individual = new Individual (final_personas);
- debug (" Created new individual '%s' with personas:",
- final_individual.id);
+ debug (" Created new individual '%s' (%p) with personas:",
+ final_individual.id, final_individual);
foreach (var p in final_personas)
{
+ debug (" %s (%p)", p.uid, p);
this._add_persona_to_link_map (p, final_individual);
}
@@ -1115,6 +1116,30 @@ public class Folks.IndividualAggregator : Object
{
iter.get_key ().replace (iter.get_value ());
}
+
+ /* Validate the link map. */
+ if (this._debug.debug_output_enabled == true)
+ {
+ var iter2 = HashTableIter<string, Individual> (this._link_map);
+ string link_key;
+ Individual individual;
+
+ while (iter2.next (out link_key, out individual) == true)
+ {
+ if (this._individuals.get (individual.id) != individual)
+ {
+ warning ("Link map contains invalid mapping:\n" +
+ " %s â %s (%p)",
+ link_key, individual.id, individual);
+ warning ("Individual %s (%p) personas:", individual.id,
+ individual);
+ foreach (var p in individual.personas)
+ {
+ warning (" %s (%p)", p.uid, p);
+ }
+ }
+ }
+ }
}
private void _is_writeable_changed_cb (Object object, ParamSpec pspec)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]