From 068187a898cdd2e26e9b16c348ecc1ed2dee3f29 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 1 Dec 2022 15:26:11 +0100 Subject: loplugin:unocast (VCLXWindow) (See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: Ic151fd657cb780291009ee4c9db51a35dfa7f357 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144335 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- toolkit/source/helper/unowrapper.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'toolkit') diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 080847154cb2..2874087e14ef 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -179,7 +180,7 @@ void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, const css::uno::Refer css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer(); if( xPeer.is() ) { - bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() )); + bool bSameInstance( pVCLXWindow == comphelper::getFromUnoTunnel< VCLXWindow >( xPeer )); SAL_WARN_IF( !bSameInstance, "toolkit.helper", "UnoWrapper::SetWindowInterface: there is already a WindowPeer/ComponentInterface for this VCL window" ); if ( bSameInstance ) return; -- cgit