summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-19 15:24:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-19 19:20:32 +0200
commit6989c3df0facf3a5cb373942c337cbc7879fc0db (patch)
tree59545a7bf5cbc0f06fe38e183c865588a08e8cce /toolkit
parent3f72d4d68817210ef6852e83d6d4bbdb540cea18 (diff)
fix crash in X-Ray extension
caused by commit 883b7a34d288410ac6f820e91d9eaa65ba2b9cb1 DBG_ASSERT->assert in UnoWrapper No idea why X-ray is triggering this, but it seems to work when I dial it back to a SAL_WARN again And also caused by commit 5aa60be574ece81b27c8f63e6e809871c694dba0 fix leak in VCLXWindow So disconnect the toolkit-window-peer from the vcl::Window before disposing the peer. Change-Id: I3310b76c1affc13c53c1e23810e383a8d2152ec7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115806 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/helper/unowrapper.cxx24
1 files changed, 16 insertions, 8 deletions
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index 8474b45399c4..a83cd540ba5e 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -170,16 +170,24 @@ void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, const css::uno::Refer
if ( !pVCLXWindow )
return;
- css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
- if( xPeer.is() )
+ if (!pWindow)
+ {
+ // we are disconnecting a peer from a window
+ pVCLXWindow->SetWindow( nullptr );
+ }
+ else
{
- bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() ));
- assert( bSameInstance && "UnoWrapper::SetWindowInterface: there is already a WindowPeer/ComponentInterface for this VCL window" );
- if ( bSameInstance )
- return;
+ css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
+ if( xPeer.is() )
+ {
+ bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() ));
+ SAL_WARN_IF( !bSameInstance, "toolkit.helper", "UnoWrapper::SetWindowInterface: there is already a WindowPeer/ComponentInterface for this VCL window" );
+ if ( bSameInstance )
+ return;
+ }
+ pVCLXWindow->SetWindow( pWindow );
+ pWindow->SetWindowPeer( xIFace, pVCLXWindow );
}
- pVCLXWindow->SetWindow( pWindow );
- pWindow->SetWindowPeer( xIFace, pVCLXWindow );
}
css::uno::Reference<css::awt::XPopupMenu> UnoWrapper::CreateMenuInterface( PopupMenu* pPopupMenu )