fixes some crashes with Dispose()
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1215
941a03a8-eaeb-0310-b9a0-
b1bbd8fe43fe
BrowseServiceTypes ("local");
Console.WriteLine ("Press enter to quit");
Console.ReadLine ();
+ client.Dispose ();
}
private static void OnEntryGroupChanged (object o, EntryGroupStateArgs args)
throw new ClientException (error);
thread = new Thread (PollLoop);
- thread.IsBackground = true;
thread.Start ();
}
public void Dispose ()
{
if (handle != IntPtr.Zero) {
- avahi_client_free (handle);
- avahi_simple_poll_quit (spoll);
- avahi_simple_poll_free (spoll);
- handle = IntPtr.Zero;
+ lock (this) {
+ avahi_client_free (handle);
+ avahi_simple_poll_quit (spoll);
+ avahi_simple_poll_free (spoll);
+ handle = IntPtr.Zero;
+ }
}
}