2005-10-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* glib/MainContext.cs: added a Depth property to p/invoke g_main_depth.
	* glib/Object.cs:
	(Dispose): immediately call g_object_unref without queueing when
	possible (MainContext.Depth > 0) and use Timeout.Add instead of Idle.Add
	to get our unref callback scheduled more reliably.


svn path=/trunk/gtk-sharp/; revision=51448
This commit is contained in:
Gonzalo Paniagua Javier 2005-10-07 21:33:30 +00:00
parent 8456979ca5
commit 8900d1ccd7
3 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2005-10-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* glib/MainContext.cs: added a Depth property to p/invoke g_main_depth.
* glib/Object.cs:
(Dispose): immediately call g_object_unref without queueing when
possible (MainContext.Depth > 0) and use Timeout.Add instead of Idle.Add
to get our unref callback scheduled more reliably.
2005-10-05 Mike Kestner <mkestner@novell.com>
* bootstrap : bump version for beta3.

View File

@ -26,6 +26,12 @@ namespace GLib {
public class MainContext {
[DllImport("libglib-2.0-0.dll")]
static extern int g_main_depth ();
public static int Depth {
get { return g_main_depth (); }
}
[DllImport("libglib-2.0-0.dll")]
static extern bool g_main_context_iteration (IntPtr Raw, bool MayBlock);

View File

@ -80,11 +80,18 @@ namespace GLib {
return;
disposed = true;
if (MainContext.Depth > 0) {
g_object_unref (_obj);
Objects.Remove (_obj);
GC.SuppressFinalize (this);
return;
}
lock (PendingDestroys){
PendingDestroys.Add (this);
lock (typeof (Object)){
if (!idle_queued){
Idle.Add (new IdleHandler (PerformQueuedUnrefs));
Timeout.Add (50, new TimeoutHandler (PerformQueuedUnrefs));
idle_queued = true;
}
}