Author: mkestner
Date: 2005-02-28 13:15:04 -0500 (Mon, 28 Feb 2005)
New Revision: 41292

Modified:
   branches/gtk-sharp-1-0-branch/gtk-sharp/ChangeLog
   branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Idle.cs
   branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Source.cs
   branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Timeout.cs
Log:

2005-02-28  Mike Kestner  <[EMAIL PROTECTED]>

        * glib/Idle.cs : add locking on the source_handlers.
        * glib/Source.cs : add locking on the source_handlers.
        * glib/Timeout.cs : add locking on the source_handlers.


Modified: branches/gtk-sharp-1-0-branch/gtk-sharp/ChangeLog
===================================================================
--- branches/gtk-sharp-1-0-branch/gtk-sharp/ChangeLog   2005-02-28 18:13:26 UTC 
(rev 41291)
+++ branches/gtk-sharp-1-0-branch/gtk-sharp/ChangeLog   2005-02-28 18:15:04 UTC 
(rev 41292)
@@ -1,3 +1,9 @@
+2005-02-28  Mike Kestner  <[EMAIL PROTECTED]>
+
+       * glib/Idle.cs : add locking on the source_handlers.
+       * glib/Source.cs : add locking on the source_handlers.
+       * glib/Timeout.cs : add locking on the source_handlers.
+
 2005-02-25  Mike Kestner  <[EMAIL PROTECTED]>
 
        * glib/Source.cs : remove from the hash by key.

Modified: branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Idle.cs
===================================================================
--- branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Idle.cs        2005-02-28 
18:13:26 UTC (rev 41291)
+++ branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Idle.cs        2005-02-28 
18:15:04 UTC (rev 41292)
@@ -60,7 +60,8 @@
                {
                        IdleProxy p = new IdleProxy (hndlr);
                        uint code = g_idle_add ((IdleHandler) p.proxy_handler, 
IntPtr.Zero);
-                       Source.source_handlers [code] = p;
+                       lock (Source.source_handlers)
+                               Source.source_handlers [code] = p;
 
                        return code;
                }
@@ -73,18 +74,20 @@
                        bool result = false;
                        ArrayList keys = new ArrayList ();
 
-                       foreach (uint code in Source.source_handlers.Keys){
-                               IdleProxy p = Source.source_handlers [code] as 
IdleProxy;
+                       lock (Source.source_handlers) {
+                               foreach (uint code in 
Source.source_handlers.Keys) {
+                                       IdleProxy p = Source.source_handlers 
[code] as IdleProxy;
                                
-                               if (p != null && p.real_handler == hndlr) {
-                                       keys.Add (code);
-                                       result = 
g_source_remove_by_funcs_user_data (p.proxy_handler, IntPtr.Zero);
+                                       if (p != null && p.real_handler == 
hndlr) {
+                                               keys.Add (code);
+                                               result = 
g_source_remove_by_funcs_user_data (p.proxy_handler, IntPtr.Zero);
+                                       }
                                }
+
+                               foreach (object key in keys)
+                                       Source.source_handlers.Remove (key);
                        }
 
-                       foreach (object key in keys)
-                               Source.source_handlers.Remove (key);
-
                        return result;
                }
        }

Modified: branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Source.cs
===================================================================
--- branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Source.cs      2005-02-28 
18:13:26 UTC (rev 41291)
+++ branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Source.cs      2005-02-28 
18:15:04 UTC (rev 41292)
@@ -35,11 +35,13 @@
                internal void Remove ()
                {
                        ArrayList keys = new ArrayList ();
-                       foreach (uint code in Source.source_handlers.Keys)
-                               if (Source.source_handlers [code] == this)
-                                       keys.Add (code);
-                       foreach (object key in keys)
-                               Source.source_handlers.Remove (key);
+                       lock (Source.source_handlers) {
+                               foreach (uint code in 
Source.source_handlers.Keys)
+                                       if (Source.source_handlers [code] == 
this)
+                                               keys.Add (code);
+                               foreach (object key in keys)
+                                       Source.source_handlers.Remove (key);
+                       }
                        real_handler = null;
                        proxy_handler = null;
                }
@@ -55,7 +57,8 @@
 
                public static bool Remove (uint tag)
                {
-                       source_handlers.Remove (tag);
+                       lock (Source.source_handlers)
+                               source_handlers.Remove (tag);
                        return g_source_remove (tag);
                }
        }

Modified: branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Timeout.cs
===================================================================
--- branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Timeout.cs     2005-02-28 
18:13:26 UTC (rev 41291)
+++ branches/gtk-sharp-1-0-branch/gtk-sharp/glib/Timeout.cs     2005-02-28 
18:15:04 UTC (rev 41292)
@@ -55,7 +55,8 @@
                        TimeoutProxy p = new TimeoutProxy (hndlr);
 
                        uint code = g_timeout_add (interval, (TimeoutHandler) 
p.proxy_handler, IntPtr.Zero);
-                       Source.source_handlers [code] = p;
+                       lock (Source.source_handlers)
+                               Source.source_handlers [code] = p;
 
                        return code;
                }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to