You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user