X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-daemon%2Fdbus-service-browser.c;h=1515ddfbc164a0c397f19014e78392894c090a60;hb=4762665d22b1e3097b537e9a5e27d2f2b0bfcfde;hp=dc10b814a197c25e404ee34ac730fb71c74f0621;hpb=9e4237ebed07d00bf1176178d1358b475d749b27;p=catta diff --git a/avahi-daemon/dbus-service-browser.c b/avahi-daemon/dbus-service-browser.c index dc10b81..1515ddf 100644 --- a/avahi-daemon/dbus-service-browser.c +++ b/avahi-daemon/dbus-service-browser.c @@ -38,8 +38,12 @@ void avahi_dbus_service_browser_free(ServiceBrowserInfo *i) { if (i->service_browser) avahi_s_service_browser_free(i->service_browser); - dbus_connection_unregister_object_path(server->bus, i->path); - avahi_free(i->path); + + if (i->path) { + dbus_connection_unregister_object_path(server->bus, i->path); + avahi_free(i->path); + } + AVAHI_LLIST_REMOVE(ServiceBrowserInfo, service_browsers, i->client->service_browsers, i); i->client->n_objects--; @@ -65,7 +69,7 @@ DBusHandlerResult avahi_dbus_msg_service_browser_impl(DBusConnection *c, DBusMes /* Introspection */ if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) - return avahi_dbus_handle_introspect(c, m, "ServiceBrowser.Introspect"); + return avahi_dbus_handle_introspect(c, m, "ServiceBrowser.introspect"); /* Access control */ if (strcmp(dbus_message_get_sender(m), i->client->name)) @@ -101,10 +105,6 @@ void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex i assert(b); assert(i); - i_interface = (int32_t) interface; - i_protocol = (int32_t) protocol; - u_flags = (uint32_t) flags; - m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, avahi_dbus_map_browse_signal_name(event)); if (event == AVAHI_BROWSER_NEW) { @@ -114,6 +114,10 @@ void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex i flags |= AVAHI_LOOKUP_RESULT_OUR_OWN; } + i_interface = (int32_t) interface; + i_protocol = (int32_t) protocol; + u_flags = (uint32_t) flags; + if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) { assert(name); assert(type);