]> git.meshlink.io Git - catta/blobdiff - avahi-sharp/Client.cs
add a missing lock, and make the event processing thread non-background.
[catta] / avahi-sharp / Client.cs
index 6d39469072947cb6fd0f7ad694be45df239d013d..40ca4119adc917d560913578c34d251aaab2223a 100644 (file)
@@ -271,7 +271,6 @@ namespace Avahi
                 throw new ClientException (error);
 
             thread = new Thread (PollLoop);
-            thread.IsBackground = true;
             thread.Start ();
         }
 
@@ -286,10 +285,12 @@ namespace Avahi
         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;
+                }
             }
         }