mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
2004-05-18 Mike Kestner <mkestner@ximian.com>
* glib/MissingIntPtrCtorException.cs : new exception to throw if unable to access an IntPtr ctor on a GLib.Object subclass. We need an IntPtr ctor to be able to wrap arbitrary object handles. * glib/Object.cs : have NativeType call LookupGType. * glib/ObjectManager.cs : throw the new exception in a try/catch. svn path=/trunk/gtk-sharp/; revision=27563
This commit is contained in:
parent
bfc77b2230
commit
0d052516f1
@ -1,3 +1,11 @@
|
|||||||
|
2004-05-18 Mike Kestner <mkestner@ximian.com>
|
||||||
|
|
||||||
|
* glib/MissingIntPtrCtorException.cs : new exception to throw if
|
||||||
|
unable to access an IntPtr ctor on a GLib.Object subclass. We need
|
||||||
|
an IntPtr ctor to be able to wrap arbitrary object handles.
|
||||||
|
* glib/Object.cs : have NativeType call LookupGType.
|
||||||
|
* glib/ObjectManager.cs : throw the new exception in a try/catch.
|
||||||
|
|
||||||
2004-05-17 Mike Kestner <mkestner@ximian.com>
|
2004-05-17 Mike Kestner <mkestner@ximian.com>
|
||||||
|
|
||||||
* generator/ObjectGen.cs : Generate a .cctor that calls the assembly's
|
* generator/ObjectGen.cs : Generate a .cctor that calls the assembly's
|
||||||
|
@ -26,6 +26,7 @@ sources = \
|
|||||||
ManagedValue.cs \
|
ManagedValue.cs \
|
||||||
Markup.cs \
|
Markup.cs \
|
||||||
Marshaller.cs \
|
Marshaller.cs \
|
||||||
|
MissingIntPtrCtorException.cs \
|
||||||
Object.cs \
|
Object.cs \
|
||||||
ObjectManager.cs \
|
ObjectManager.cs \
|
||||||
Opaque.cs \
|
Opaque.cs \
|
||||||
|
20
glib/MissingIntPtrCtorException.cs
Normal file
20
glib/MissingIntPtrCtorException.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// MissingIntPtrCtorException.cs : Exception for missing IntPtr ctors
|
||||||
|
//
|
||||||
|
// Authors: Mike Kestner <mkestner@ximian.com>
|
||||||
|
//
|
||||||
|
// Copyright (c) 2004 Novell, Inc.
|
||||||
|
|
||||||
|
namespace GLib {
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
public class MissingIntPtrCtorException : Exception
|
||||||
|
{
|
||||||
|
public MissingIntPtrCtorException (string msg) : base (msg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -207,10 +207,7 @@ namespace GLib {
|
|||||||
|
|
||||||
internal GLib.GType NativeType {
|
internal GLib.GType NativeType {
|
||||||
get {
|
get {
|
||||||
if (_obj == IntPtr.Zero)
|
return LookupGType ();
|
||||||
return GType.Invalid;
|
|
||||||
|
|
||||||
return new GLib.GType (gtksharp_get_type_id (_obj));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,13 @@ namespace GtkSharp {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (GLib.Object) Activator.CreateInstance (t, new object[] {raw});
|
GLib.Object obj;
|
||||||
|
try {
|
||||||
|
obj = (GLib.Object) Activator.CreateInstance (t, new object[] {raw});
|
||||||
|
} catch (MissingMethodException) {
|
||||||
|
throw new GLib.MissingIntPtrCtorException ("All GLib.Object subclasses must provide a protected or public IntPtr ctor to support wrapping of native object handles.");
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RegisterType (string native_name, string managed_name, string assembly)
|
public static void RegisterType (string native_name, string managed_name, string assembly)
|
||||||
|
Loading…
Reference in New Issue
Block a user