minutes of ESC call ...

Stephan Bergmann sbergman at redhat.com
Wed Jan 4 13:53:20 UTC 2023


On 14/12/2022 13:19, Stephan Bergmann wrote:
> 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)."

...but 
<https://git.libreoffice.org/core/+/ef533553559fe09b4afab651fc692885d1acf4ed%5E%21> 
"Rudimentary support for dynamic_cast on UNO proxy objects" to the rescue :)



More information about the LibreOffice mailing list