diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-10 12:53:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-11 06:55:41 +0000 |
commit | 78b4a1fb01af9ad3b3395a22f6e396be914b553e (patch) | |
tree | 846fdaea907a70fdc274a1e76642ed5e06622c0d /sc | |
parent | 071e23fee07b92b8f07800cda3ca7e66afe818ae (diff) |
update vclwidget loplugin to find ref-dropping assigment
Look for places where we are accidentally assigning a returned-by-value
VclPtr<T> to a T*, which generally ends up in a use-after-free.
Change-Id: I4f361eaca88820cdb7aa3b8340212db61580fdd9
Reviewed-on: https://gerrit.libreoffice.org/30749
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/miscdlgs/retypepassdlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/sidebar/ScPanelFactory.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaeventshelper.cxx | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/sc/source/ui/miscdlgs/retypepassdlg.cxx b/sc/source/ui/miscdlgs/retypepassdlg.cxx index 4ab1183674c0..30809d7788c4 100644 --- a/sc/source/ui/miscdlgs/retypepassdlg.cxx +++ b/sc/source/ui/miscdlgs/retypepassdlg.cxx @@ -113,7 +113,7 @@ void ScRetypePassDlg::SetDataFromDocument(const ScDocument& rDoc) VclPtr<FixedText> pFtSheetName = VclPtr<FixedText>::Create(pSheet); pFtSheetName->Show(); pFtSheetName->SetStyle(WB_VCENTER); - FixedText* pFtSheetStatus = VclPtr<FixedText>::Create(pSheet); + VclPtr<FixedText> pFtSheetStatus = VclPtr<FixedText>::Create(pSheet); pFtSheetStatus->Show(); pFtSheetStatus->SetStyle(WB_VCENTER); diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx index 7665ebfe874e..e7054009704f 100644 --- a/sc/source/ui/sidebar/ScPanelFactory.cxx +++ b/sc/source/ui/sidebar/ScPanelFactory.cxx @@ -69,7 +69,7 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement ( const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); - vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); if ( ! xParentWindow.is() || pParentWindow==nullptr) throw RuntimeException( "PanelFactory::createUIElement called without ParentWindow", diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx index 050d41052fa2..67fbf6486d39 100644 --- a/sc/source/ui/vba/vbaeventshelper.cxx +++ b/sc/source/ui/vba/vbaeventshelper.cxx @@ -221,7 +221,7 @@ void ScVbaEventListener::startControllerListening( const uno::Reference< frame:: if( xControllerBorder.is() ) try { xControllerBorder->addBorderResizeListener( this ); } catch( uno::Exception& ) {} - if( vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ) ) + if( VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ) ) { maControllers[ pWindow ] = rxController; } @@ -243,7 +243,7 @@ void ScVbaEventListener::stopControllerListening( const uno::Reference< frame::X if( xControllerBorder.is() ) try { xControllerBorder->removeBorderResizeListener( this ); } catch( uno::Exception& ) {} - if( vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ) ) + if( VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ) ) { maControllers.erase( pWindow ); if( pWindow == mpActiveWindow ) @@ -278,8 +278,8 @@ void SAL_CALL ScVbaEventListener::windowActivated( const lang::EventObject& rEve if( !mbDisposed ) { uno::Reference< awt::XWindow > xWindow( rEvent.Source, uno::UNO_QUERY ); - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - OSL_TRACE( "ScVbaEventListener::windowActivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow, mpActiveWindow.get() ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); + OSL_TRACE( "ScVbaEventListener::windowActivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow.get(), mpActiveWindow.get() ); // do not fire activation event multiple time for the same window if( pWindow && (pWindow != mpActiveWindow) ) { @@ -300,8 +300,8 @@ void SAL_CALL ScVbaEventListener::windowDeactivated( const lang::EventObject& rE if( !mbDisposed ) { uno::Reference< awt::XWindow > xWindow( rEvent.Source, uno::UNO_QUERY ); - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - OSL_TRACE( "ScVbaEventListener::windowDeactivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow, mpActiveWindow.get() ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); + OSL_TRACE( "ScVbaEventListener::windowDeactivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow.get(), mpActiveWindow.get() ); // do not fire the deactivation event, if the window is not active (prevent multiple deactivation) if( pWindow && (pWindow == mpActiveWindow) ) processWindowActivateEvent( pWindow, false ); |