diff --git a/ChangeLog b/ChangeLog index 7a7fedeb1..943f97abd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-12-17 Mike Kestner + + * gtk/Gtk.metadata : hide Object and Widget.Destroy. + * gtk/Object.custom : manual virtual Destroy impl. + * gtk/Widget.custom : manual virtual Destroy impl. + * gtk/Window.custom : hold a managed ref for all toplevels. Release + it in a Destroy override. Window is frequently subclassed and is + never parented, so this keeps a managed ref around to avoid GC. + [Fixes #70120] + 2004-12-17 Mike Kestner * gdk/Gdk.metadata : mark out param on Window.GetFrameExtents. diff --git a/doc/en/Gtk/Object.xml b/doc/en/Gtk/Object.xml index 461e476ce..469c7019e 100644 --- a/doc/en/Gtk/Object.xml +++ b/doc/en/Gtk/Object.xml @@ -31,7 +31,7 @@ The differences between Gtk.Object and GLib. is a hi - + Method System.Void @@ -431,4 +431,4 @@ The object is only destroyed if all the references to the object are released, t - \ No newline at end of file + diff --git a/doc/en/Gtk/Widget.xml b/doc/en/Gtk/Widget.xml index 9e80944b9..981809a00 100644 --- a/doc/en/Gtk/Widget.xml +++ b/doc/en/Gtk/Widget.xml @@ -1008,14 +1008,14 @@ - + Method System.Void - Destroys a . + Destroys a widget. Equivalent to , except that you don't have to cast the to . When a is destroyed, it will break any references it holds to other objects. If the is inside a container, the will be removed from the container. If the is a toplevel (derived from ), it will be removed from the list of toplevels, and the reference GTK+ holds to it will be removed. @@ -3725,7 +3725,7 @@ xs a - This property should only be used when writing custom widgets in C#. The property is a preferred more strongly typed member. This member is obsolete in Gtk# 2.0. + This property should only be used when writing custom widgets in C#. The property is a preferred more strongly typed member. This member is obsolete in Gtk# 2.0. See for possible values. diff --git a/doc/en/Gtk/Window.xml b/doc/en/Gtk/Window.xml index d57af3305..f6737ef7e 100644 --- a/doc/en/Gtk/Window.xml +++ b/doc/en/Gtk/Window.xml @@ -1730,5 +1730,17 @@ Console.WriteLine("Width: {0}, Height: {1}" , width , height); To be added + + + Method + + System.Void + + + + Destroys a Window. + All toplevel windows must be explicitly destroyed. + + - \ No newline at end of file + diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index b775d2524..f2347940b 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -232,6 +232,7 @@ Deactivated 1 1 + 1 Destroyed 1 1 @@ -372,6 +373,7 @@ 1 1 out + 1 1 ProcessEvent out diff --git a/gtk/Object.custom b/gtk/Object.custom index 7b1b32c96..fad8d7c4d 100755 --- a/gtk/Object.custom +++ b/gtk/Object.custom @@ -47,6 +47,14 @@ } } + [DllImport("libgtk-win32-2.0-0.dll")] + private static extern void gtk_object_destroy (IntPtr raw); + + public virtual void Destroy () + { + gtk_object_destroy (Handle); + } + public bool IsFloating { get { return gtksharp_object_is_floating (Handle); diff --git a/gtk/Widget.custom b/gtk/Widget.custom index 929908091..b5010b188 100644 --- a/gtk/Widget.custom +++ b/gtk/Widget.custom @@ -28,6 +28,14 @@ protected Widget (GLib.GType gtype) : base(gtype) ParentSet += new ParentSetHandler (Widget_ParentSet); } +[DllImport("libgtk-win32-2.0-0.dll")] +static extern void gtk_widget_destroy (IntPtr raw); + +public override void Destroy () +{ + gtk_widget_destroy (Handle); +} + protected override void CreateNativeObject (string[] names, GLib.Value[] vals) { base.CreateNativeObject (names, vals); diff --git a/gtk/Window.custom b/gtk/Window.custom index 2a159ae04..e56db7f62 100755 --- a/gtk/Window.custom +++ b/gtk/Window.custom @@ -26,6 +26,8 @@ [DllImport("libgobject-2.0-0.dll")] private static extern void g_object_ref (IntPtr raw); + static Hashtable windows = new Hashtable (); + protected override IntPtr Raw { get { return base.Raw; @@ -35,9 +37,16 @@ if (value == IntPtr.Zero) return; g_object_ref (value); + windows [value] = this; } } + public override void Destroy () + { + base.Destroy (); + windows [Handle] = null; + } + public Window (String title) : this (WindowType.Toplevel) { this.Title = title;