Value: First try to invoke a constructor with IntPtr, bool

In Cairo there the default constructor does not take a ref to the native
object making the object invalid when trying to access it.

This commit changes the behaviour to search for another constructor that
takes an owner variable which is set to false when invoked to indicate
that the managed side should take a ref.
This commit is contained in:
Stephan Sundermann 2014-06-21 16:59:22 +02:00 committed by Bertrand Lorentz
parent 7ea0c4afaf
commit 1fab57eeac

View file

@ -437,7 +437,11 @@ namespace GLib {
if (mi != null)
return mi.Invoke (null, new object[] {boxed_ptr});
ConstructorInfo ci = t.GetConstructor (new Type[] { typeof(IntPtr) });
ConstructorInfo ci = t.GetConstructor (new Type[] { typeof(IntPtr), typeof (bool) });
if (ci != null)
return ci.Invoke (new object[] { boxed_ptr, false });
ci = t.GetConstructor (new Type[] { typeof(IntPtr) });
if (ci != null)
return ci.Invoke (new object[] { boxed_ptr });