32ae593a0e
* glib/Object.cs (Ref): Added. * gtk/Object.custom (Ref): Overload. Note that we were reffed. (DisposeNative): Unref if we were explicitly reffed. * generator/Method.cs: Call Ref if needs_ret is set. * generator/StructBase.cs: Call Ref on all object accessors. * glue/style.c: Ref returned GCs. * sources/Gtk.metadata: Set needs_ret on various gdk-related accessors in GtkWidget. Hide Ref/Unref methods on Widget and RcStyle as these ought to be deprecated anyway. svn path=/trunk/gtk-sharp/; revision=7380
28 lines
580 B
Text
Executable file
28 lines
580 B
Text
Executable file
// Gtk.Object.custom - Gtk Window class customizations
|
|
//
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
//
|
|
// (c) 2002 Mike Kestner
|
|
//
|
|
// This code is inserted after the automatically generated code.
|
|
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern void gtksharp_object_unref_if_floating (IntPtr raw);
|
|
|
|
protected override void DisposeNative ()
|
|
{
|
|
if (_needs_unref)
|
|
base.DisposeNative ();
|
|
else
|
|
gtksharp_object_unref_if_floating (Handle);
|
|
}
|
|
|
|
private bool _needs_unref = false;
|
|
|
|
public override void Ref ()
|
|
{
|
|
_needs_unref = true;
|
|
base.Ref ();
|
|
}
|
|
|