- IntPtr hostPtr = Utility.StringToPtr (hostname);
- handle = avahi_host_name_resolver_new (client.Handle, iface, proto, hostPtr, aproto,
- OnHostNameResolverCallback, IntPtr.Zero);
- Utility.Free (hostPtr);
+ lock (client) {
+ handle = avahi_host_name_resolver_new (client.Handle, iface, proto,
+ Utility.StringToBytes (hostname), aproto, flags,
+ cb, IntPtr.Zero);
+
+ if (handle == IntPtr.Zero)
+ client.ThrowError ();
+ }