From f008291cbe70ba06626481a0cd4f22b7535e80bc Mon Sep 17 00:00:00 2001 From: Alex Corrado Date: Wed, 16 Nov 2011 18:51:59 -0500 Subject: [PATCH] Fix issue with value types that don't implement ICppObject --- src/Mono.Cxxi/Abi/CppAbi.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Mono.Cxxi/Abi/CppAbi.cs b/src/Mono.Cxxi/Abi/CppAbi.cs index 63be6fdd..d6169b8f 100644 --- a/src/Mono.Cxxi/Abi/CppAbi.cs +++ b/src/Mono.Cxxi/Abi/CppAbi.cs @@ -5,6 +5,7 @@ // Alexander Corrado (alexander.corrado@gmail.com) // // Copyright (C) 2010-2011 Alexander Corrado +// Copyright 2011 Xamarin Inc (http://www.xamarin.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -750,8 +751,6 @@ namespace Mono.Cxxi.Abi { CppTypeInfo targetTypeInfo = null; if (targetType == typeof (ICppObject)) targetType = typeof (CppInstancePtr); - else - targetTypeInfo = GetTypeInfo (targetType); // FIXME: woof. do we really have to do this? // check for a native constructor (i.e. a public ctor in the wrapper that takes CppInstancePtr) if (typeof (ICppObject).IsAssignableFrom (targetType)) { @@ -765,6 +764,8 @@ namespace Mono.Cxxi.Abi { var hasWrapper = il.DefineLabel (); + if (targetTypeInfo == null) + targetTypeInfo = GetTypeInfo (targetType); // FIXME: woof. do we really have to do this? if (targetTypeInfo != null && targetTypeInfo.VirtualMethods.Any ()) { il.Emit (OpCodes.Ldloca, cppip); il.Emit (OpCodes.Call, cppip_native);