Daniel Boelzle <daniel.boelzle <at> sun.com> writes:
>
> Yes, you are actually throwing an "Exception *", but catching the
> non-pointered "Exception". Always throw C++-UNO exceptions like this
>
> throw FooBarException();
>
> additional tip: always catch by reference (Exception &), saving an extra
> copy construction.
Daniel
Thanks for helping on this. I am pretty sure that this is not
the issue. I had already tried these attempts
1. catch (Exception& e)
2. catch (Exception e)
3. catch (...)
Also, what is the gcc compiler version that OpenOffice 2 is being
built up with. I use gdb 6.3 to debug and I tried these
gcc versions:gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
and gcc version 3.2
Modified bit of my code:
OUString oStr = OUString::createFromAscii("foo.Counter");
try
{
throw (com::sun::star::uno::Exception());
//also tried
// throw (com::sun::star::uno::Exception(oStr,xMgr));
}
catch (com::sun::star::uno::Exception& e)
{
}
catch (...)
{}
Error:
cd ../../../LINUXexample.out/bin && countermain
< MyCounterImpl ctor called >
42,43,42
terminate called after throwing an instance of
'com::sun::star::uno::Exception'
/bin/sh: line 1: 16894 Aborted countermain
make: *** [countermain.run] Error 134
Stack trace
#0 0x00ad47a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x00b14955 in raise () from /lib/tls/libc.so.6
#2 0x00b16319 in abort () from /lib/tls/libc.so.6
#3 0xf6cc2ad1 in __gnu_cxx::__verbose_terminate_handler () from
/opt/openoffice.org1.9.113/program/libstdc++.so.6
#4 0xf6cc0505 in __cxa_call_unexpected () from
/opt/openoffice.org1.9.113/program/libstdc++.so.6
#5 0xf6cc0542 in std::terminate () from
/opt/openoffice.org1.9.113/program/libstdc++.so.6
#6 0xf6cc06d2 in __cxa_throw () from
/opt/openoffice.org1.9.113/program/libstdc++.so.6
#7 0xf69e6717 in component_getFactory () from
/opt/openoffice.org1.9.113/program/simplereg.uno.so
#8 0x0804950b in main (argc=1, argv=0xfeed3774) at ustring.hxx:1250
I dont know why gdb shows this abort and programs crash at starting of
main.
On the command line/shell, it crashes when Exception is thrown by me,
as proved by some result
< MyCounterImpl ctor called >
42,43,42
Has anybody tried try/catch (exceptions) using SDK? If not, could somebody
just paste my snippet in his counter example and check
if s/he is able to handle exceptions. This behavior is strange.
And gdb is even stranger :(.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]