diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-01-11 00:56:22 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-01-13 11:38:04 +0000 |
commit | 464f109cb6f506b26a500a90eeba32c42432b83d (patch) | |
tree | 58131c9e0057cbfe3336c0591bb2ed1afcaa261a /svx | |
parent | 09336ca3d8c9cfdc87522802106113d5b00247eb (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>
(cherry picked from commit e1f5db9579602dd02a80c1d1ea1d078606542f16)
Reviewed-on: https://gerrit.libreoffice.org/32956
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.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 36b57a84d31b..6e7b8e0feade 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2699,10 +2699,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() @@ -2718,25 +2724,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 ); @@ -2746,10 +2748,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() |