[gnome-contacts] Add comments about tricky behaviour and fix warnings



commit 0febcb5ddf32751780b9ed9dc5df512ffe40ed0f
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Aug 26 08:44:33 2011 +0200

    Add comments about tricky behaviour and fix warnings

 src/contacts-contact.vala |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 48964cf..2206f98 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -254,6 +254,7 @@ public class Contacts.Contact : GLib.Object  {
     int i = refs.length;
     refs.resize(i+1);
     refs[i].key = key;
+    // Transfer ownership to the array
     refs[i].data = (void *)(owned)data;
   }
 
@@ -262,7 +263,11 @@ public class Contacts.Contact : GLib.Object  {
 
     for (i = 0; i < refs.length; i++) {
       if (refs[i].key == key) {
+	// We need to unref the data so we take a local
+	// owned copy and let it go out of scope
 	T old_val = (owned)refs[i].data;
+	// Reference the variable to avoid warning
+	(void)old_val;
 	for (int j = i + 1; j < refs.length; j++) {
 	  refs[j-1] = refs[j];
 	}



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