Make sure VCLXPopupMenu has unique RTTI

...by providing a non-inline key function for that class.  This would have
prevented the issue that has been addressed by
2fe53b2e43 "Fix crash due to unexpected
dynamic_cast failures in optimized build", where a dynamic_cast to VCLXPopupMenu
failed on macOS (which uses pointer equivalence to determine RTTI equivalence),
because VCLXPopupMenu is final, so the compiler, at least in optimized builds,
just used a comparison between the object's recorded RTTI (from dylib A) against
the type's RTTI in dylib B, which erroneously failed.

Change-Id: I68ff864c266bf28d19032527f91de592ca1437f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176188
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
Stephan Bergmann 2024-11-07 08:44:28 +01:00
parent 6e1207c9de
commit 709b1f3ddb
2 changed files with 4 additions and 0 deletions

View file

@ -149,6 +149,8 @@ class TOOLKIT_DLLPUBLIC VCLXPopupMenu final : public VCLXMenu
public:
VCLXPopupMenu();
VCLXPopupMenu( PopupMenu* pPopMenu );
~VCLXPopupMenu() override;
};
#endif // INCLUDED_TOOLKIT_AWT_VCLXMENU_HXX

View file

@ -880,6 +880,8 @@ VCLXPopupMenu::VCLXPopupMenu( PopupMenu* pPopMenu ) : VCLXMenu( static_cast<Menu
ImplAddListener();
}
VCLXPopupMenu::~VCLXPopupMenu() = default;
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
stardiv_Toolkit_VCLXPopupMenu_get_implementation(
css::uno::XComponentContext *,