tag: Unregister Record before Tag
authorSamuel Ortiz <sameo@linux.intel.com>
Sun, 10 Nov 2013 16:22:19 +0000 (17:22 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 10 Nov 2013 16:57:09 +0000 (17:57 +0100)
When a Tag is leaving the field, it makes more sense to
unregister its associated records before the Device itself, and not the
other way around.

src/tag.c

index b36fa23..1dd0a61 100644 (file)
--- a/src/tag.c
+++ b/src/tag.c
@@ -645,12 +645,6 @@ void __near_tag_remove(struct near_tag *tag)
 
        DBG("path %s", tag->path);
 
-       if (!g_hash_table_lookup(tag_hash, tag->path))
-               return;
-
-       g_dbus_unregister_interface(connection, tag->path,
-                                               NFC_TAG_INTERFACE);
-
        g_hash_table_remove(tag_hash, path);
 }
 
@@ -1047,6 +1041,9 @@ static void free_tag(gpointer data)
 
        near_ndef_records_free(tag->records);
 
+       g_dbus_unregister_interface(connection, tag->path,
+                                               NFC_TAG_INTERFACE);
+
        g_free(tag->path);
        g_free(tag->data);
        g_free(tag);