https://bugs.documentfoundation.org/show_bug.cgi?id=167853

--- Comment #1 from Pierre le Riche <[email protected]> ---
Created attachment 207866
  --> https://bugs.documentfoundation.org/attachment.cgi?id=207866&action=edit
Patch to IUnknownWrapper::invoke to raise the appropriate veto exception

Notes for the proposed patch (attached):

It is not currently possible to veto document closing or application
termination when the XCloseListener/XTerminateListener is implemented
via the OLE Automation bridge (e.g. a VBA/COM object), because any
error the COM object raises inside queryClosing()/queryTermination()
comes back from IDispatch::Invoke as DISP_E_EXCEPTION, which
IUnknownWrapper::invoke() turns into a generic
css::lang::InvocationTargetException wrapped inside a
WrappedTargetRuntimeException - never into CloseVetoException or
TerminationVetoException.

Since queryClosing/queryTermination have no other legitimate
exception, translate any exception the automation object raises
while these two specific methods are being invoked into the
corresponding veto exception.

Note this veto exception must itself be re-wrapped inside a
css::reflection::InvocationTargetException before being thrown out
of invoke(), since that is the only exception XInvocation::invoke()
is permitted to throw per its IDL contract, and it is the only
exception type the invocation-adapter factory
(stoc/source/invocation_adapterfactory/iafactory.cxx,
handleInvokExc()) knows how to unwrap and pass through as the real
exception - anything else it receives is unconditionally flattened
into a plain RuntimeException, silently discarding the veto.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to