diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-06-02 15:51:47 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-06-07 08:36:29 +0200 |
commit | 481a435d1ea2ab210c826fe77b632fc76b8f830e (patch) | |
tree | 3c39f25355962851df935759cd83c99cdfbced06 /toolkit | |
parent | e772298b7736a7c82d7c31bc78cf453645762658 (diff) |
Fix leak with stock widgets in a dialog from an extension
When loading a dialog from XDL, buttons can have dlg:button-type="cancel"
or dlg:button-type="help". These buttons might not have a peer when
they are not referenced from the extension.
In this case, they also weren't disposed when the dialog was disposed,
leading to an abort on exit.
Change-Id: I799d7535b766984fde47cafbe41ee6e89e476205
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135316
Tested-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/helper/unowrapper.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 13fa5aeb7537..938aa8d75983 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -224,10 +224,13 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow ) VclPtr< vcl::Window > pNextChild = pChild->GetWindow( GetWindowType::Next ); VclPtr< vcl::Window > pClient = pChild->GetWindow( GetWindowType::Client ); - if ( pClient && pClient->GetWindowPeer() ) + if ( pClient ) { - css::uno::Reference< css::lang::XComponent > xComp = pClient->GetComponentInterface( false ); - xComp->dispose(); + // Create the window peer (true argument for pClient->GetComponentInterface) when it's not yet there. + // We need it to dispose the child windows properly, otherwise the vcl::Window will be leaked. + css::uno::Reference< css::lang::XComponent > xComp = pClient->GetComponentInterface( true ); + if (xComp.is()) + xComp->dispose(); } pChild = pNextChild; |