From 990d345674c6dc7d8f07655d1d2e1ea61d173853 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 25 Dec 2008 03:36:25 +0100 Subject: [PATCH] Add destruct callback to element structure --- include/element.h | 7 +++++++ src/element.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/include/element.h b/include/element.h index 083533d..e8199b7 100644 --- a/include/element.h +++ b/include/element.h @@ -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 { diff --git a/src/element.c b/src/element.c index 145d6fa..fba5fb8 100644 --- a/src/element.c +++ b/src/element.c @@ -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); -- 2.7.4