summaryrefslogtreecommitdiff
path: root/sc/source/ui/vba
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-10 12:53:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-11 06:55:41 +0000
commit78b4a1fb01af9ad3b3395a22f6e396be914b553e (patch)
tree846fdaea907a70fdc274a1e76642ed5e06622c0d /sc/source/ui/vba
parent071e23fee07b92b8f07800cda3ca7e66afe818ae (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/source/ui/vba')
-rw-r--r--sc/source/ui/vba/vbaeventshelper.cxx12
1 files changed, 6 insertions, 6 deletions
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 );