2004-12-17 Mike Kestner <mkestner@novell.com>

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

svn path=/trunk/gtk-sharp/; revision=37914
This commit is contained in:
Mike Kestner 2004-12-17 23:21:53 +00:00
parent d97845dbf0
commit 9727ef31e2
8 changed files with 55 additions and 6 deletions

View File

@ -1,3 +1,13 @@
2004-12-17 Mike Kestner <mkestner@novell.com>
* 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 <mkestner@novell.com>
* gdk/Gdk.metadata : mark out param on Window.GetFrameExtents.

View File

@ -31,7 +31,7 @@ The differences between Gtk.Object and GLib.<see cref="T:GLib.Object" /> is a hi
<Attributes />
<Members>
<Member MemberName="Destroy">
<MemberSignature Language="C#" Value="public void Destroy ();" />
<MemberSignature Language="C#" Value="public virtual void Destroy ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
@ -431,4 +431,4 @@ The object is only destroyed if all the references to the object are released, t
</Docs>
</Member>
</Members>
</Type>
</Type>

View File

@ -1008,14 +1008,14 @@
</Docs>
</Member>
<Member MemberName="Destroy">
<MemberSignature Language="C#" Value="public void Destroy ();" />
<MemberSignature Language="C#" Value="public override void Destroy ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Destroys a <paramref name="widget" />.</summary>
<summary>Destroys a widget.</summary>
<remarks>
<para>
Equivalent to <see cref="M:Gtk.Object.Destroy" />, except that you don't have to cast the <paramref name="widget" /> to <see cref="T:Gtk.Object" />. When a <paramref name="widget" /> is destroyed, it will break any references it holds to other objects. If the <paramref name="widget" /> is inside a container, the <paramref name="widget" /> will be removed from the container. If the <paramref name="widget" /> is a toplevel (derived from <see cref="T:Gtk.Window" />), it will be removed from the list of toplevels, and the reference GTK+ holds to it will be removed.
@ -3725,7 +3725,7 @@ xs <Member MemberName="OnMapEvent">
<returns>a <see cref="T:System.Int32" /></returns>
<remarks>
<para>
This property should only be used when writing custom widgets in C#. The <see cref="M:Gtk.Widget.WidgetFlags"/> 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 <see cref="M:Gtk.Widget.WidgetFlags" /> property is a preferred more strongly typed member. This member is obsolete in Gtk# 2.0.
</para>
<para>
See <see cref="T:Gtk.WidgetFlags" /> for possible values.

View File

@ -1730,5 +1730,17 @@ Console.WriteLine("Width: {0}, Height: {1}" , width , height);</code>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="Destroy">
<MemberSignature Language="C#" Value="public override void Destroy ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Destroys a Window.</summary>
<remarks>All toplevel windows must be explicitly destroyed.</remarks>
</Docs>
</Member>
</Members>
</Type>
</Type>

View File

@ -232,6 +232,7 @@
<attr path="/api/namespace/object[@cname='GtkMenuShell']/signal[@name='Deactivate']" name="name">Deactivated</attr>
<attr path="/api/namespace/object[@cname='GtkMessageDialog']/constructor[@cname='gtk_message_dialog_new']/*/*[@type='GtkWindow*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkObject']/constructor[@cname='gtk_object_new']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkObject']/method[@name='Destroy']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkObject']/signal[@name='Destroy']" name="name">Destroyed</attr>
<attr path="/api/namespace/object[@cname='GtkPixmap']/constructor[@cname='gtk_pixmap_new']/*/*[@type='GdkBitmap*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkPixmap']/method[@name='Set']/*/*[@type='GdkBitmap*']" name="null_ok">1</attr>
@ -372,6 +373,7 @@
<attr path="/api/namespace/object[@cname='GtkWidget']" name="disable_gtype_ctor">1</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/constructor[@cname='gtk_widget_new']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='ClassPath']/*/*[@type='gchar**']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='Destroy']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='Destroyed']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='Event']" name="name">ProcessEvent</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetChildRequisition']/*/*[@name='requisition']" name="pass_as">out</attr>

View File

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

View File

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

View File

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