Adapt remaining cpp_uno bridges to #i114635#

..."C++ UNO bridge should convert non-UNO exceptions into RuntimeException"
(<https://bz.apache.org/ooo/show_bug.cgi?id=114635>), see
<https://lists.freedesktop.org/archives/libreoffice/2018-April/079985.html>
"Re: CppunitTest_sw_filters_test failing on x86 Linux, std::exception ->
uno::RuntimeException".

(The msvc_win32_{intel,x86-64} versions already handle non-UNO exceptions in
their msc{i,x}_filterCppException functions, in a different way.)

Change-Id: Ie359affed6831d16be0de3e3ff065484e28bd9c3
Reviewed-on: https://gerrit.libreoffice.org/52665
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2018-04-10 10:06:23 +02:00
parent 2ad679b7f6
commit 4544713d3a
18 changed files with 380 additions and 89 deletions

View File

@@ -21,7 +21,9 @@
#include <rtl/alloc.h>
#include <com/sun/star/uno/genfunc.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include "com/sun/star/uno/RuntimeException.hpp"
#include <o3tl/runtimetooustring.hxx>
#include <uno/data.h>
#include <bridge.hxx>
@@ -31,8 +33,10 @@
#include "share.hxx"
#include <exception>
#include <stdio.h>
#include <string.h>
#include <typeinfo>
/*
* Based on http://gcc.gnu.org/PR41443
@@ -524,13 +528,23 @@ static void cpp_call(
try
{
callVirtualMethod(
pAdjustedThisPtr, aVtableSlot.index,
pCppReturn, pReturnTypeRef,
pStackStart,
(pStack - pStackStart),
pGPR, nGPR,
pFPR);
try {
callVirtualMethod(
pAdjustedThisPtr, aVtableSlot.index,
pCppReturn, pReturnTypeRef,
pStackStart,
(pStack - pStackStart),
pGPR, nGPR,
pFPR);
} catch (css::uno::Exception &) {
throw;
} catch (std::exception & e) {
throw css::uno::RuntimeException(
"C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": "
+ o3tl::runtimeToOUString(e.what()));
} catch (...) {
throw css::uno::RuntimeException("C++ code threw unknown exception");
}
// NO exception occurred...
*ppUnoExc = 0;