2009-05-12 Mike Kestner <mkestner@novell.com>

* glib/Value.cs: explicit exception for unknown props.
	[Fixes #502043] Patch by Sebastian Dröge.

svn path=/trunk/gtk-sharp/; revision=134021
This commit is contained in:
Mike Kestner 2009-05-12 23:53:50 +00:00
parent bb08d67c7a
commit bccd244a70
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2009-05-12 Mike Kestner <mkestner@novell.com>
* glib/Value.cs: explicit exception for unknown props.
[Fixes #502043] Patch by Sebastian Dröge.
2009-05-12 Mike Kestner <mkestner@novell.com>
* glib/ValueArray.cs: make ctor(IntPtr) public for binding usage.

View file

@ -525,8 +525,13 @@ namespace GLib {
void InitForProperty (GType gtype, string name)
{
IntPtr p_name = Marshaller.StringToPtrGStrdup (name);
ParamSpec spec = new ParamSpec (g_object_class_find_property (gtype.ClassPtr, p_name));
IntPtr spec_ptr = g_object_class_find_property (gtype.ClassPtr, p_name);
Marshaller.Free (p_name);
if (spec_ptr == IntPtr.Zero)
throw new Exception (String.Format ("No property with name '{0}' in type '{1}'", name, gtype.ToString()));
ParamSpec spec = new ParamSpec (spec_ptr);
g_value_init (ref this, spec.ValueType.Val);
}