2008-02-21 Mike Kestner <mkestner@novell.com>

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

svn path=/trunk/gtk-sharp/; revision=96363
This commit is contained in:
Mike Kestner 2008-02-21 16:32:03 +00:00
parent 4c6671c625
commit c949e6e8de
4 changed files with 22 additions and 14 deletions

View file

@ -1,3 +1,16 @@
2008-02-21 Mike Kestner <mkestner@novell.com>
* 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 <mkestner@novell.com>
* generator/ReturnValue.cs: null term array marshaling.
* glib/Marshaller.cs: new marshalers for null-terminated string
arrays. [Fixes #342113]
2008-02-07 Mike Kestner <mkestner@novell.com>
* generator/Parameters.cs: fix off-by-1 in null term array marshaling.

View file

@ -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")]

View file

@ -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;
}

View file

@ -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;
}
}
}