[folks] Bug 653746 — mismatch between hash and equals in Note



commit ad06533f4035e19cda7a21c23ede10a06c35de60
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Jun 30 18:55:41 2011 +0100

    Bug 653746 â mismatch between hash and equals in Note
    
    Ensure that Note instances compare equal iff their UIDs are equal (as well as
    iff their contents are equal).
    
    Closes: bgo#653746

 NEWS                    |    1 +
 folks/note-details.vala |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 35c80d0..acf66b3 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Bugs fixed:
 * Bug 652449 â Folks.Individual's property getters should be read only
 * Bug 653325 â Build system does not complain if trying to build docs without
   vala-doc installed
+* Bug 653746 â mismatch between hash and equals in Note
 
 API changes:
 * Swf.Persona retains and exposes its libsocialweb Contact
diff --git a/folks/note-details.vala b/folks/note-details.vala
index 59abdb5..bafcaaa 100644
--- a/folks/note-details.vala
+++ b/folks/note-details.vala
@@ -59,11 +59,12 @@ public class Folks.Note : Object
     }
 
   /**
-   * Compare if 2 notes are equal
+   * Compare if 2 notes are equal. This compares both their { link Note.content}
+   * and { link Note.uid} (if set).
    */
   public static bool equal (Note a, Note b)
     {
-      return (a.content == b.content);
+      return (a.uid == b.uid && a.content == b.content);
     }
 
   /**



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