Ryujinx-GtkSharp/glib/ObjectManager.cs
Bob Smith b4c11b3210 GObject fixes.
svn path=/trunk/gtk-sharp/; revision=878
2001-09-19 04:47:48 +00:00

34 lines
757 B
C#

// ObjectManager.cs - GObject class wrapper helper implementation
//
// Author: Bob Smith <bob@thestuff.net>
//
// (c) 2001 Bob Smith
namespace Glib {
using System;
using System.Runtime.InteropServices;
protected delegate void DestroyNotify (IntPtr data);
public class ObjectManager {
public ObjectManager(IntPtr o, Glib.Object go)
{
if (o == null || go -- null) throw new ArgumentNullException ();
_gobj = go;
_gobj.gh = GCHandle.Alloc (this, GCHandleType.Pinned);
Glib.Object.g_object_set_data_full(o, "gobject#-object-manager",
gh.AddrOfPinnedObject (), new DestroyNotify(DestroyNotifyEvent));
}
public Glib.Object gobj;
private void DestroyNotifyEvent (IntPtr data)
{
gobj.gh.Free();
_gobj = null;
}
}
}