]> git.meshlink.io Git - catta/blobdiff - avahi-sharp/Client.cs
work around KDE misbehaviour. (Patch from Martin Putt; Closes #135)
[catta] / avahi-sharp / Client.cs
index 6d39469072947cb6fd0f7ad694be45df239d013d..02763d40d67be6357ef00355a39b22e1d13dcfe1 100644 (file)
@@ -286,10 +286,15 @@ 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);
+                    handle = IntPtr.Zero;
+
+                    avahi_simple_poll_quit (spoll);
+                    Monitor.Wait (this);
+                    
+                    avahi_simple_poll_free (spoll);
+                }
             }
         }
 
@@ -370,6 +375,7 @@ namespace Avahi
             try {
                 lock (this) {
                     avahi_simple_poll_loop (spoll);
+                    Monitor.Pulse (this);
                 }
             } catch (Exception e) {
                 Console.Error.WriteLine ("Error in avahi-sharp event loop: " + e);