2005-02-28 Mike Kestner <mkestner@novell.com>

* 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.

svn path=/trunk/gtk-sharp/; revision=41290
This commit is contained in:
Mike Kestner 2005-02-28 18:11:24 +00:00
parent 6d70444302
commit 57972ab070
4 changed files with 29 additions and 16 deletions

View File

@ -1,3 +1,9 @@
2005-02-28 Mike Kestner <mkestner@novell.com>
* 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 <mkestner@novell.com>
* glib/Source.cs : remove from the hash by key.

View File

@ -60,7 +60,8 @@ namespace GLib {
{
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,17 +74,19 @@ namespace GLib {
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;
}

View File

@ -35,11 +35,13 @@ namespace GLib {
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 @@ namespace GLib {
public static bool Remove (uint tag)
{
source_handlers.Remove (tag);
lock (Source.source_handlers)
source_handlers.Remove (tag);
return g_source_remove (tag);
}
}

View File

@ -55,7 +55,8 @@ namespace GLib {
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;
}