minutes of ESC call ...
Stephan Bergmann
sbergman at redhat.com
Wed Dec 14 12:19:34 UTC 2022
On 02/03/2012 15:45, Stephan Bergmann wrote:
> I've never given much thought to dynamic_cast vs. XUnoTunnel (at least I
> don't remember right now I ever did; searching old mail archives would
> probably prove me wrong) -- to me XUnoTunnel was always that rarely
> needed hack where the notational overhead doesn't really hurt. But
> sure, for the UNO wrappers in the application layers things look
> different. Anyway, thinking about it now, I see no reason one could not
> use dynamic_cast instead of XUnoTunnel in the scenario outlined above.
Took me ten years to find the reason again why XUnoTunnel cannot be
replaced with dynamic_cast, in general. :) See
<https://gerrit.libreoffice.org/c/core/+/144139> "New loplugin:unocast":
"Find uses of dynamic_cast that cast from a UNO interface type.
Unless it is known that the dynamic_cast must succeed, it can cause a
crash: If the source object is a proxy from the C++ UNO bridge, its
vtable's RTTI slot will normally not be set up (see e.g. the
ENABLE_RUNTIME_OPTIMIZATIONS code in
bridges::cpp_uno::shared::VtableFactory::initializeBlock in
bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx)."
More information about the LibreOffice
mailing list