Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@@ -1,44 +0,0 @@
2010-01-19 Tom Hindle <tom_hindle@sil.org>
* ComInteropProxy.cs: Don't add proxy if it has already been added.
Instread increment ref_count. Fixes bug #572043.
2009-07-11 Robert Jordan <robertj@gmx.net>
* ComInteropProxy.cs: Implement CreateProxy. Hide public/internal
ctors forcing CreateProxy's usage. Hide CacheProxy since the
runtime is able to lookup it anyways.
Fixes bug #520437.
2007-07-26 Jonathan Chambers <joncham@gmail.com>
* ComInteropProxy.cs: Call Marshal.Release after Marshal.QI
since it AddRef's the object. Fixes COM leak. Also fix eol-style.
2007-05-25 Jonathan Chambers <joncham@gmail.com>
* ComInteropProxy.cs: Call __ComObject.GetInterface overload
that does not throw exception. Fixes as and is operators for COM objects.
2007-02-08 Jonathan Chambers <joncham@gmail.com>
* ComInteropProxy.cs: Moved some code to unmanaged and cleanup some things.
2006-10-18 Jonathan Chambers <joncham@gmail.com>
* IUnknown.cs: Added.
* IDispatch.cs: Added.
2006-08-10 Jonathan Chambers <joncham@gmail.com>
* ComInteropProxy.cs: Fix default constructor being always
being called.
2006-07-28 Jonathan Chambers <joncham@gmail.com>
* ComInteropProxy.cs: Added support for marshalling objects.
2006-07-15 Jonathan Chambers <joncham@gmail.com>
* ComInteropProxy.cs: Added.

View File

@@ -68,7 +68,7 @@ namespace Mono.Interop
{
// called from unmanaged code after .ctor is invoked
// we need .ctor to create unmanaged object and thus IUnknown property value
if (FindProxy(com_object.IUnknown) == null)
if (FindProxy (com_object.IUnknown) == null)
AddProxy (com_object.IUnknown, this);
else
System.Threading.Interlocked.Increment (ref ref_count);
@@ -82,7 +82,7 @@ namespace Mono.Interop
internal ComInteropProxy (IntPtr pUnk, Type t)
: base (t)
{
com_object = new __ComObject (pUnk);
com_object = new __ComObject (pUnk, this);
CacheProxy ();
}
@@ -108,17 +108,20 @@ namespace Mono.Interop
// already known, a cached proxy will be returned.
internal static ComInteropProxy CreateProxy (Type t)
{
ComInteropProxy proxy = new ComInteropProxy (t);
proxy.com_object.Initialize (t);
ComInteropProxy cachedProxy = FindProxy (proxy.com_object.IUnknown);
IntPtr iunknown = __ComObject.CreateIUnknown (t);
ComInteropProxy proxy;
ComInteropProxy cachedProxy = FindProxy (iunknown);
if (cachedProxy != null) {
// check that the COM type of the cached proxy matches
// the requested type. See 2nd part of bug #520437.
Type cachedType = cachedProxy.com_object.GetType ();
if (cachedType != t)
throw new InvalidCastException (String.Format ("Unable to cast object of type '{0}' to type '{1}'.", cachedType, t));
return cachedProxy;
proxy = cachedProxy;
Marshal.Release (iunknown);
} else {
proxy = new ComInteropProxy (t);
proxy.com_object.Initialize (iunknown, proxy);
}
return proxy;
}