diff --git a/ChangeLog b/ChangeLog index fc5ae2afd..b02c47ea7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-02-21 Mike Kestner + + * glib/Source.cs: rework proxy removal to avoid boxing profile. + * glib/Idle.cs: save src_id in proxy to facilitate removal. + * glib/Timeout.cs: save src_id in proxy to facilitate removal. + [Fixes #359561] + +2008-02-07 Mike Kestner + + * generator/ReturnValue.cs: null term array marshaling. + * glib/Marshaller.cs: new marshalers for null-terminated string + arrays. [Fixes #342113] + 2008-02-07 Mike Kestner * generator/Parameters.cs: fix off-by-1 in null term array marshaling. diff --git a/glib/Idle.cs b/glib/Idle.cs index a475603bf..02f44c68e 100755 --- a/glib/Idle.cs +++ b/glib/Idle.cs @@ -68,11 +68,11 @@ namespace GLib { public static uint Add (IdleHandler hndlr) { IdleProxy p = new IdleProxy (hndlr); - uint code = g_idle_add ((IdleHandlerInternal) p.proxy_handler, IntPtr.Zero); + p.ID = g_idle_add ((IdleHandlerInternal) p.proxy_handler, IntPtr.Zero); lock (Source.source_handlers) - Source.source_handlers [code] = p; + Source.source_handlers [p.ID] = p; - return code; + return p.ID; } [DllImport("libglib-2.0-0.dll")] diff --git a/glib/Source.cs b/glib/Source.cs index 3e8f8121c..afbd020f3 100644 --- a/glib/Source.cs +++ b/glib/Source.cs @@ -33,17 +33,12 @@ namespace GLib { internal class SourceProxy { internal Delegate real_handler; internal Delegate proxy_handler; + internal uint ID; internal void Remove () { - ArrayList keys = new ArrayList (); - 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); - } + lock (Source.source_handlers) + Source.source_handlers.Remove (ID); real_handler = null; proxy_handler = null; } diff --git a/glib/Timeout.cs b/glib/Timeout.cs index c13edc3e4..bc6633dd9 100755 --- a/glib/Timeout.cs +++ b/glib/Timeout.cs @@ -62,11 +62,11 @@ namespace GLib { { TimeoutProxy p = new TimeoutProxy (hndlr); - uint code = g_timeout_add (interval, (TimeoutHandlerInternal) p.proxy_handler, IntPtr.Zero); + p.ID = g_timeout_add (interval, (TimeoutHandlerInternal) p.proxy_handler, IntPtr.Zero); lock (Source.source_handlers) - Source.source_handlers [code] = p; + Source.source_handlers [p.ID] = p; - return code; + return p.ID; } } }