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:
parent
d97845dbf0
commit
9727ef31e2
8 changed files with 55 additions and 6 deletions
10
ChangeLog
10
ChangeLog
|
@ -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>
|
2004-12-17 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
* gdk/Gdk.metadata : mark out param on Window.GetFrameExtents.
|
* gdk/Gdk.metadata : mark out param on Window.GetFrameExtents.
|
||||||
|
|
|
@ -31,7 +31,7 @@ The differences between Gtk.Object and GLib.<see cref="T:GLib.Object" /> is a hi
|
||||||
<Attributes />
|
<Attributes />
|
||||||
<Members>
|
<Members>
|
||||||
<Member MemberName="Destroy">
|
<Member MemberName="Destroy">
|
||||||
<MemberSignature Language="C#" Value="public void Destroy ();" />
|
<MemberSignature Language="C#" Value="public virtual void Destroy ();" />
|
||||||
<MemberType>Method</MemberType>
|
<MemberType>Method</MemberType>
|
||||||
<ReturnValue>
|
<ReturnValue>
|
||||||
<ReturnType>System.Void</ReturnType>
|
<ReturnType>System.Void</ReturnType>
|
||||||
|
|
|
@ -1008,14 +1008,14 @@
|
||||||
</Docs>
|
</Docs>
|
||||||
</Member>
|
</Member>
|
||||||
<Member MemberName="Destroy">
|
<Member MemberName="Destroy">
|
||||||
<MemberSignature Language="C#" Value="public void Destroy ();" />
|
<MemberSignature Language="C#" Value="public override void Destroy ();" />
|
||||||
<MemberType>Method</MemberType>
|
<MemberType>Method</MemberType>
|
||||||
<ReturnValue>
|
<ReturnValue>
|
||||||
<ReturnType>System.Void</ReturnType>
|
<ReturnType>System.Void</ReturnType>
|
||||||
</ReturnValue>
|
</ReturnValue>
|
||||||
<Parameters />
|
<Parameters />
|
||||||
<Docs>
|
<Docs>
|
||||||
<summary>Destroys a <paramref name="widget" />.</summary>
|
<summary>Destroys a widget.</summary>
|
||||||
<remarks>
|
<remarks>
|
||||||
<para>
|
<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.
|
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>
|
<returns>a <see cref="T:System.Int32" /></returns>
|
||||||
<remarks>
|
<remarks>
|
||||||
<para>
|
<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>
|
||||||
<para>
|
<para>
|
||||||
See <see cref="T:Gtk.WidgetFlags" /> for possible values.
|
See <see cref="T:Gtk.WidgetFlags" /> for possible values.
|
||||||
|
|
|
@ -1730,5 +1730,17 @@ Console.WriteLine("Width: {0}, Height: {1}" , width , height);</code>
|
||||||
<remarks>To be added</remarks>
|
<remarks>To be added</remarks>
|
||||||
</Docs>
|
</Docs>
|
||||||
</Member>
|
</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>
|
</Members>
|
||||||
</Type>
|
</Type>
|
|
@ -232,6 +232,7 @@
|
||||||
<attr path="/api/namespace/object[@cname='GtkMenuShell']/signal[@name='Deactivate']" name="name">Deactivated</attr>
|
<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='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']/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='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']/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>
|
<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']" 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']/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='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='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='Event']" name="name">ProcessEvent</attr>
|
||||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetChildRequisition']/*/*[@name='requisition']" name="pass_as">out</attr>
|
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetChildRequisition']/*/*[@name='requisition']" name="pass_as">out</attr>
|
||||||
|
|
|
@ -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 {
|
public bool IsFloating {
|
||||||
get {
|
get {
|
||||||
return gtksharp_object_is_floating (Handle);
|
return gtksharp_object_is_floating (Handle);
|
||||||
|
|
|
@ -28,6 +28,14 @@ protected Widget (GLib.GType gtype) : base(gtype)
|
||||||
ParentSet += new ParentSetHandler (Widget_ParentSet);
|
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)
|
protected override void CreateNativeObject (string[] names, GLib.Value[] vals)
|
||||||
{
|
{
|
||||||
base.CreateNativeObject (names, vals);
|
base.CreateNativeObject (names, vals);
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
[DllImport("libgobject-2.0-0.dll")]
|
[DllImport("libgobject-2.0-0.dll")]
|
||||||
private static extern void g_object_ref (IntPtr raw);
|
private static extern void g_object_ref (IntPtr raw);
|
||||||
|
|
||||||
|
static Hashtable windows = new Hashtable ();
|
||||||
|
|
||||||
protected override IntPtr Raw {
|
protected override IntPtr Raw {
|
||||||
get {
|
get {
|
||||||
return base.Raw;
|
return base.Raw;
|
||||||
|
@ -35,9 +37,16 @@
|
||||||
if (value == IntPtr.Zero)
|
if (value == IntPtr.Zero)
|
||||||
return;
|
return;
|
||||||
g_object_ref (value);
|
g_object_ref (value);
|
||||||
|
windows [value] = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Destroy ()
|
||||||
|
{
|
||||||
|
base.Destroy ();
|
||||||
|
windows [Handle] = null;
|
||||||
|
}
|
||||||
|
|
||||||
public Window (String title) : this (WindowType.Toplevel)
|
public Window (String title) : this (WindowType.Toplevel)
|
||||||
{
|
{
|
||||||
this.Title = title;
|
this.Title = title;
|
||||||
|
|
Loading…
Add table
Reference in a new issue