2007-04-12 Mike Kestner <mkestner@novell.com>
* glib/Object.cs : do the Timeout switch in the finalizer instead of in Dispose, where it can cause problems if people override Dispose. * generator/ObjectGen.cs : don't generate finalizers for every subclass, just rely on the ~GLib.Object implementation. svn path=/trunk/gtk-sharp/; revision=75657
This commit is contained in:
parent
a8b11a7445
commit
2ff726d3e6
3 changed files with 29 additions and 26 deletions
|
@ -1,3 +1,11 @@
|
|||
2007-04-12 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* glib/Object.cs : do the Timeout switch in the finalizer
|
||||
instead of in Dispose, where it can cause problems if people
|
||||
override Dispose.
|
||||
* generator/ObjectGen.cs : don't generate finalizers for every
|
||||
subclass, just rely on the ~GLib.Object implementation.
|
||||
|
||||
2007-04-12 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* glib/Idle.cs :
|
||||
|
|
|
@ -255,11 +255,6 @@ namespace GtkSharp.Generation {
|
|||
if (!Elem.HasAttribute("parent"))
|
||||
return;
|
||||
|
||||
gen_info.Writer.WriteLine("\t\t~" + Name + "()");
|
||||
gen_info.Writer.WriteLine("\t\t{");
|
||||
gen_info.Writer.WriteLine("\t\t\tDispose();");
|
||||
gen_info.Writer.WriteLine("\t\t}");
|
||||
gen_info.Writer.WriteLine();
|
||||
if (!DisableGTypeCtor) {
|
||||
gen_info.Writer.WriteLine("\t\t[Obsolete]");
|
||||
gen_info.Writer.WriteLine("\t\tprotected " + Name + "(GLib.GType gtype) : base(gtype) {}");
|
||||
|
|
|
@ -40,7 +40,15 @@ namespace GLib {
|
|||
|
||||
~Object ()
|
||||
{
|
||||
Dispose ();
|
||||
lock (PendingDestroys){
|
||||
PendingDestroys.Add (this);
|
||||
lock (typeof (Object)){
|
||||
if (!idle_queued){
|
||||
Timeout.Add (50, new TimeoutHandler (PerformQueuedUnrefs));
|
||||
idle_queued = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("libgobject-2.0-0.dll")]
|
||||
|
@ -62,18 +70,7 @@ namespace GLib {
|
|||
if (o._obj == IntPtr.Zero)
|
||||
continue;
|
||||
|
||||
try {
|
||||
ToggleRef toggle_ref = Objects [o._obj] as ToggleRef;
|
||||
if (toggle_ref == null)
|
||||
g_object_unref (o._obj);
|
||||
else
|
||||
toggle_ref.Free ();
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine ("Exception while disposing a " + o + " in Gtk#");
|
||||
throw e;
|
||||
}
|
||||
Objects.Remove (o._obj);
|
||||
o._obj = IntPtr.Zero;
|
||||
o.Dispose ();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -84,15 +81,18 @@ namespace GLib {
|
|||
return;
|
||||
|
||||
disposed = true;
|
||||
lock (PendingDestroys){
|
||||
PendingDestroys.Add (this);
|
||||
lock (typeof (Object)){
|
||||
if (!idle_queued){
|
||||
Timeout.Add (50, new TimeoutHandler (PerformQueuedUnrefs));
|
||||
idle_queued = true;
|
||||
}
|
||||
}
|
||||
try {
|
||||
ToggleRef toggle_ref = Objects [_obj] as ToggleRef;
|
||||
if (toggle_ref == null)
|
||||
g_object_unref (_obj);
|
||||
else
|
||||
toggle_ref.Free ();
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine ("Exception while disposing a " + this + " in Gtk#");
|
||||
throw e;
|
||||
}
|
||||
Objects.Remove (_obj);
|
||||
_obj = IntPtr.Zero;
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue