mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Noticed that my change for BUG-1616 doesn't help, as the exception in not a ComException, so I rewrote it to use a catch statement. [skip ci]
This commit is contained in:
parent
49f788c3d6
commit
01cc22e871
1 changed files with 4 additions and 5 deletions
|
@ -38,8 +38,6 @@ namespace Greenshot.Interop {
|
|||
private const int CO_E_CLASSSTRING = -2147221005;
|
||||
public const int RPC_E_CALL_REJECTED = unchecked((int)0x80010001);
|
||||
public const int RPC_E_FAIL = unchecked((int)0x80004005);
|
||||
public const int RPC_E_COM_SEPARATED_RCW = unchecked((int)0x80131527);
|
||||
|
||||
|
||||
#region Private Data
|
||||
|
||||
|
@ -673,6 +671,10 @@ namespace Greenshot.Interop {
|
|||
try {
|
||||
returnValue = invokeType.InvokeMember(methodName, flags, null, invokeObject, args, argModifiers, null, null);
|
||||
break;
|
||||
} catch (InvalidComObjectException icoEx) {
|
||||
// Should assist BUG-1616 and others
|
||||
LOG.WarnFormat("COM object {0} has been separated from its underlying RCW cannot be used. The COM object was released while it was still in use on another thread.", _InterceptType.FullName);
|
||||
return new ReturnMessage(icoEx, callMessage);
|
||||
} catch (Exception ex) {
|
||||
// Test for rejected
|
||||
COMException comEx = ex as COMException;
|
||||
|
@ -693,9 +695,6 @@ namespace Greenshot.Interop {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if (comEx != null && comEx.ErrorCode == RPC_E_COM_SEPARATED_RCW) {
|
||||
LOG.WarnFormat("COM object {0} has been separated from its underlying RCW cannot be used. The COM object was released while it was still in use on another thread.", _InterceptType.FullName);
|
||||
}
|
||||
// Not rejected OR pressed cancel
|
||||
return new ReturnMessage(ex, callMessage);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue