diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-01-11 00:56:22 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2017-01-11 10:04:24 +0000 |
commit | e1f5db9579602dd02a80c1d1ea1d078606542f16 (patch) | |
tree | 3d1a0484f39b2e6a9fcd36fcc08259e667ffce21 /svx | |
parent | ef0323b0fa935e445ac9c809117812ed88ba59de (diff) |
SvxFontNameBox_Impl was not disposed
This is visible after toolbar customization, when the old
font box stays visible. Turns out that currently the toolbox
controller is supposed to own the item window, not the toolbox.
Regression of:
commit 970a66f8c919ea0524f216f40d21b3e2a8c88ccc
Author: Maxim Monastirsky <momonasmon@gmail.com>
Date: Sun Oct 16 01:27:10 2016 +0300
Use UNO registration for font name toolbox control
Change-Id: I29a1f06d97c9a981507ff62889e2d7fc6ac9d688
Reviewed-on: https://gerrit.libreoffice.org/32943
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index cf449f9ceffd..13db72df34ee 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2683,10 +2683,16 @@ public: // XToolbarController virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& rParent ) throw ( css::uno::RuntimeException, std::exception ) override; + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException, std::exception ) override; + // XServiceInfo virtual OUString SAL_CALL getImplementationName() throw ( css::uno::RuntimeException, std::exception ) override; virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw ( css::uno::RuntimeException, std::exception ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw ( css::uno::RuntimeException, std::exception ) override; + +private: + VclPtr<SvxFontNameBox_Impl> m_pBox; }; SvxFontNameToolBoxControl::SvxFontNameToolBoxControl() @@ -2702,25 +2708,21 @@ void SvxFontNameToolBoxControl::statusChanged( const css::frame::FeatureStateEve if ( !getToolboxId( nId, &pToolBox ) ) return; - SvxFontNameBox_Impl* pBox = static_cast<SvxFontNameBox_Impl*>(pToolBox->GetItemWindow( nId )); - - DBG_ASSERT( pBox, "Control not found!" ); - if ( !rEvent.IsEnabled ) { - pBox->Disable(); - pBox->Update( nullptr ); + m_pBox->Disable(); + m_pBox->Update( nullptr ); } else { - pBox->Enable(); + m_pBox->Enable(); css::awt::FontDescriptor aFontDesc; if ( rEvent.State >>= aFontDesc ) - pBox->Update( &aFontDesc ); + m_pBox->Update( &aFontDesc ); else - pBox->SetText( "" ); - pBox->SaveValue(); + m_pBox->SetText( "" ); + m_pBox->SaveValue(); } pToolBox->EnableItem( nId, rEvent.IsEnabled ); @@ -2730,10 +2732,17 @@ css::uno::Reference< css::awt::XWindow > SvxFontNameToolBoxControl::createItemWi throw ( css::uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - VclPtrInstance<SvxFontNameBox_Impl> pBox( VCLUnoHelper::GetWindow( rParent ), - Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), - m_xFrame,0); - return VCLUnoHelper::GetInterface( pBox ); + m_pBox = VclPtr<SvxFontNameBox_Impl>::Create( VCLUnoHelper::GetWindow( rParent ), + Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), + m_xFrame, 0); + return VCLUnoHelper::GetInterface( m_pBox ); +} + +void SvxFontNameToolBoxControl::dispose() + throw ( css::uno::RuntimeException, std::exception ) +{ + m_pBox.disposeAndClear(); + ToolboxController::dispose(); } OUString SvxFontNameToolBoxControl::getImplementationName() |