]> git.meshlink.io Git - catta/commitdiff
add a missing lock, and make the event processing thread non-background.
authorJames Willcox <snopr@snorp.net>
Sun, 7 May 2006 18:51:06 +0000 (18:51 +0000)
committerJames Willcox <snopr@snorp.net>
Sun, 7 May 2006 18:51:06 +0000 (18:51 +0000)
fixes some crashes with Dispose()

git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1215 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-sharp/AvahiTest.cs
avahi-sharp/Client.cs

index fcec737fea79d0019ee5d1f86a2ada10be6517ba..ba4d59b9e7b2a343843e102fdee36a890304b417 100644 (file)
@@ -42,6 +42,7 @@ public class AvahiTest {
         BrowseServiceTypes ("local");
         Console.WriteLine ("Press enter to quit");
         Console.ReadLine ();
+        client.Dispose ();
     }
 
     private static void OnEntryGroupChanged (object o, EntryGroupStateArgs args)
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;
+                }
             }
         }