From 24e661eb636f6397b4a149156f451cb551d32013 Mon Sep 17 00:00:00 2001 From: Trent Lloyd Date: Sun, 14 Aug 2005 12:18:03 +0000 Subject: * Remove AvahiEntryGroups from the client's list when we free it * Add a test for AvahiEntryGroup free() git-svn-id: file:///home/lennart/svn/public/avahi/trunk@322 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-client/client-test.c | 15 ++++++++++++--- avahi-client/entrygroup.c | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'avahi-client') diff --git a/avahi-client/client-test.c b/avahi-client/client-test.c index 3dab390..352ee58 100644 --- a/avahi-client/client-test.c +++ b/avahi-client/client-test.c @@ -59,14 +59,22 @@ avahi_service_type_browser_callback (AvahiServiceTypeBrowser *b, AvahiIfIndex in } gboolean -test_free (gpointer data) +test_free_domain_browser (gpointer data) { - printf ("XXX: freeing\n"); + printf ("XXX: freeing domain browser\n"); AvahiServiceBrowser *b = data; avahi_service_browser_free (b); return FALSE; } +gboolean +test_free_entry_group (gpointer data) +{ + printf ("XXX: freeing entry group\n"); + AvahiEntryGroup *g = data; + avahi_entry_group_free (g); + return FALSE; +} int main (int argc, char *argv[]) { @@ -134,7 +142,8 @@ main (int argc, char *argv[]) else printf ("Sucessfully created service browser, path %s\n", avahi_service_browser_path (sb)); - g_timeout_add (2000, test_free, sb); + g_timeout_add (2000, test_free_entry_group, group); + g_timeout_add (5000, test_free_domain_browser, sb); g_main_loop_run (loop); diff --git a/avahi-client/entrygroup.c b/avahi-client/entrygroup.c index 26ae75a..2748d86 100644 --- a/avahi-client/entrygroup.c +++ b/avahi-client/entrygroup.c @@ -126,6 +126,8 @@ avahi_entry_group_free (AvahiEntryGroup *group) return avahi_client_set_errno (client, AVAHI_ERR_DBUS_ERROR); dbus_connection_send (client->bus, message, NULL); + + AVAHI_LLIST_REMOVE(AvahiEntryGroup, groups, client->groups, group); free (group); -- cgit