23464e6514
[Equal credit to Ettore Perazzoli <ettore@ximian.com> for fixing all the bugs in the initial patch] * */*.custom : fix incorrect usage of new Object (IntPtr) where Glib.Object.GetObject should've been used. add ref_owned param to GetObject calls. * generator/CallbackGen.cs : setup ref_owned in bodies * generator/ClassBase.cs : add ref_owned to GetObject FromNative call * generator/Method.cs : setup ref_owned in bodies * generator/Property.cs : setup ref_owned in bodies * generator/SignalHandler.cs : pass ref_owned to GetObject * generator/StructBase.cs : setup ref_owned in bodies * glib/Object.cs : kill Ref/Unref methods. Don't want it to be easy for users to screw with ref counts, or make it look like they should need to. (GetObject): add ref_owned param and ref/unref to remain at 1 * glib/Value.cs : pass ref_owned to GetObject svn path=/trunk/gtk-sharp/; revision=16581
27 lines
782 B
Text
Executable file
27 lines
782 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")]
|
|
private static extern bool gtksharp_object_is_floating (IntPtr raw);
|
|
|
|
[DllImport("libgobject-2.0-0.dll")]
|
|
private static extern void g_object_ref (IntPtr raw);
|
|
|
|
protected override IntPtr Raw {
|
|
get {
|
|
return base.Raw;
|
|
}
|
|
set {
|
|
base.Raw = value;
|
|
if (gtksharp_object_is_floating (value)) {
|
|
g_object_ref (value);
|
|
Sink ();
|
|
}
|
|
// System.Diagnostics.Debug.WriteLine ("Gtk.Object:set_Raw: object type is: " + (this as GLib.Object).GType.Name + " refcount now: " + RefCount + " needs_ref: " + needs_ref);
|
|
}
|
|
}
|