summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-13 18:12:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-13 20:52:05 +0200
commit883b7a34d288410ac6f820e91d9eaa65ba2b9cb1 (patch)
treeb205e04242a843838fc8178ef0be00a13165b634
parentcan pass by const& here (diff)
downloadcore-883b7a34d288410ac6f820e91d9eaa65ba2b9cb1.tar.gz
core-883b7a34d288410ac6f820e91d9eaa65ba2b9cb1.zip
DBG_ASSERT->assert in UnoWrapper
Change-Id: Ibc6b489f12c2734869bd45f93f946a53e3015226 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115564 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--toolkit/source/helper/unowrapper.cxx19
1 files changed, 10 insertions, 9 deletions
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index d4f0b3501ca9..8474b45399c4 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -35,7 +35,7 @@
using namespace ::com::sun::star;
-static css::uno::Reference< css::awt::XWindowPeer > CreateXWindow( vcl::Window const * pWindow )
+static rtl::Reference<VCLXWindow> CreateXWindow( vcl::Window const * pWindow )
{
switch ( pWindow->GetType() )
{
@@ -148,12 +148,13 @@ css::uno::Reference< css::awt::XToolkit> UnoWrapper::GetVCLToolkit()
css::uno::Reference< css::awt::XWindowPeer> UnoWrapper::GetWindowInterface( vcl::Window* pWindow )
{
css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
- if ( !xPeer.is() )
- {
- xPeer = CreateXWindow( pWindow );
- SetWindowInterface( pWindow, xPeer );
- }
- return xPeer;
+ if ( xPeer )
+ return xPeer;
+
+ rtl::Reference<VCLXWindow> xVCLXWindow = CreateXWindow( pWindow );
+ xVCLXWindow->SetWindow( pWindow );
+ pWindow->SetWindowPeer( xVCLXWindow, xVCLXWindow.get() );
+ return xVCLXWindow;
}
VclPtr<vcl::Window> UnoWrapper::GetWindow(const css::uno::Reference<css::awt::XWindow>& rWindow)
@@ -165,7 +166,7 @@ void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, const css::uno::Refer
{
VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( xIFace );
- DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" );
+ assert( pVCLXWindow && "must be a VCLXWindow subclass" );
if ( !pVCLXWindow )
return;
@@ -173,7 +174,7 @@ void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, const css::uno::Refer
if( xPeer.is() )
{
bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() ));
- DBG_ASSERT( bSameInstance, "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" );
+ assert( bSameInstance && "UnoWrapper::SetWindowInterface: there is already a WindowPeer/ComponentInterface for this VCL window" );
if ( bSameInstance )
return;
}