Add destruct callback to element structure
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 25 Dec 2008 02:36:25 +0000 (03:36 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 25 Dec 2008 02:36:25 +0000 (03:36 +0100)
include/element.h
src/element.c

index 083533dab4e2cfb2f8fc1b824b474c293fb90f5d..e8199b76e2c55cd39e396c2b234868e9d260e149 100644 (file)
@@ -103,6 +103,13 @@ struct connman_element {
        struct connman_driver *driver;
        void *driver_data;
 
+       void (*destruct) (struct connman_element *element);
+
+       union {
+               void *private;
+               struct connman_device *device;
+       };
+
        GSList *properties;
 
        struct {
index 145d6fa250a7c30c245789c2f0931a2c1b8e69c6..fba5fb88bcf08b426e58c2ca40dc829fc596ec49 100644 (file)
@@ -1192,6 +1192,8 @@ void connman_element_unref(struct connman_element *element)
                                g_atomic_int_get(&element->refcount) - 1);
 
        if (g_atomic_int_dec_and_test(&element->refcount) == TRUE) {
+               if (element->destruct)
+                       element->destruct(element);
                free_properties(element);
                g_free(element->ipv4.address);
                g_free(element->ipv4.netmask);