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 /accessibility | |
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 'accessibility')
10 files changed, 21 insertions, 21 deletions
diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx index cacf65c5cf3b..194e52a870c0 100644 --- a/accessibility/source/extended/accessibleiconchoicectrl.cxx +++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx @@ -90,7 +90,7 @@ namespace accessibility } case VCLEVENT_WINDOW_GETFOCUS : { - SvtIconChoiceCtrl* pCtrl = getCtrl(); + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); if ( pCtrl && pCtrl->HasFocus() ) { SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() ); @@ -167,7 +167,7 @@ namespace accessibility ::comphelper::OExternalLockGuard aGuard( this ); ensureAlive(); - SvtIconChoiceCtrl* pCtrl = getCtrl(); + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry(i); if ( !pEntry ) throw RuntimeException(); @@ -217,7 +217,7 @@ namespace accessibility ensureAlive(); - SvtIconChoiceCtrl* pCtrl = getCtrl(); + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex ); if ( !pEntry ) throw IndexOutOfBoundsException(); @@ -231,7 +231,7 @@ namespace accessibility ensureAlive(); - SvtIconChoiceCtrl* pCtrl = getCtrl(); + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex ); if ( !pEntry ) throw IndexOutOfBoundsException(); @@ -253,7 +253,7 @@ namespace accessibility ensureAlive(); - SvtIconChoiceCtrl* pCtrl = getCtrl(); + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); sal_Int32 nCount = pCtrl->GetEntryCount(); for ( sal_Int32 i = 0; i < nCount; ++i ) { @@ -270,7 +270,7 @@ namespace accessibility ensureAlive(); sal_Int32 nSelCount = 0; - SvtIconChoiceCtrl* pCtrl = getCtrl(); + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); sal_Int32 nCount = pCtrl->GetEntryCount(); for ( sal_Int32 i = 0; i < nCount; ++i ) { @@ -293,7 +293,7 @@ namespace accessibility Reference< XAccessible > xChild; sal_Int32 nSelCount = 0; - SvtIconChoiceCtrl* pCtrl = getCtrl(); + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); sal_Int32 nCount = pCtrl->GetEntryCount(); for ( sal_Int32 i = 0; i < nCount; ++i ) { @@ -322,7 +322,7 @@ namespace accessibility Reference< XAccessible > xChild; sal_Int32 nSelCount = 0; - SvtIconChoiceCtrl* pCtrl = getCtrl(); + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); sal_Int32 nCount = pCtrl->GetEntryCount(); bool bFound = false; for ( sal_Int32 i = 0; i < nCount; ++i ) diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx index fb9b58054d46..367e92a689c2 100644 --- a/accessibility/source/extended/accessiblelistbox.cxx +++ b/accessibility/source/extended/accessiblelistbox.cxx @@ -118,7 +118,7 @@ namespace accessibility break; case VCLEVENT_LISTBOX_TREEFOCUS: { - SvTreeListBox* pBox = getListBox(); + VclPtr<SvTreeListBox> pBox = getListBox(); bool bNeedFocus = false; if (pBox) { @@ -276,7 +276,7 @@ namespace accessibility m_mapEntry.erase(mi); } - SvTreeListBox* pBox = getListBox(); + VclPtr<SvTreeListBox> pBox = getListBox(); SvTreeListEntry* pEntryChild = pBox->FirstChild(pEntry); while (pEntryChild) { @@ -351,7 +351,7 @@ namespace accessibility ensureAlive(); sal_Int32 nCount = 0; - SvTreeListBox* pSvTreeListBox = getListBox(); + VclPtr<SvTreeListBox> pSvTreeListBox = getListBox(); if ( pSvTreeListBox ) nCount = pSvTreeListBox->GetLevelChildCount( nullptr ); diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 5fd378821197..07a67088aa73 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -267,7 +267,7 @@ css::awt::Size SAL_CALL Paragraph::getSize() void SAL_CALL Paragraph::grabFocus() throw (css::uno::RuntimeException, std::exception) { checkDisposed(); - vcl::Window* pWindow = m_xDocument->GetWindow(); + VclPtr<vcl::Window> pWindow = m_xDocument->GetWindow(); if ( pWindow ) { pWindow->GrabFocus(); diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index a147cb962735..7b5d87236990 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -288,7 +288,7 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX { Reference< XAccessibleContext > xContext; - vcl::Window* pWindow = _pXWindow->GetWindow(); + VclPtr<vcl::Window> pWindow = _pXWindow->GetWindow(); if ( pWindow ) { WindowType nType = pWindow->GetType(); diff --git a/accessibility/source/standard/floatingwindowaccessible.cxx b/accessibility/source/standard/floatingwindowaccessible.cxx index 7a3f1f59ac27..51aee0cec394 100644 --- a/accessibility/source/standard/floatingwindowaccessible.cxx +++ b/accessibility/source/standard/floatingwindowaccessible.cxx @@ -37,7 +37,7 @@ FloatingWindowAccessible::~FloatingWindowAccessible() void FloatingWindowAccessible::FillAccessibleRelationSet(utl::AccessibleRelationSetHelper& rRelationSet) { - vcl::Window* pWindow = GetWindow(); + VclPtr<vcl::Window> pWindow = GetWindow(); if ( pWindow ) { vcl::Window* pParentWindow = pWindow->GetParent(); diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx index 9af428efa24f..6f3997ed1328 100644 --- a/accessibility/source/standard/vclxaccessiblebox.cxx +++ b/accessibility/source/standard/vclxaccessiblebox.cxx @@ -160,7 +160,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven { pList->ProcessWindowEvent (rVclWindowEvent); } - vcl::Window* pWindow = GetWindow(); + VclPtr<vcl::Window> pWindow = GetWindow(); if( pWindow && (pWindow->HasFocus() || pWindow->HasChildPathFocus()) ) { Any aOldValue, aNewValue; diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx index 8b0faab35f21..b7feea96c46a 100644 --- a/accessibility/source/standard/vclxaccessiblebutton.cxx +++ b/accessibility/source/standard/vclxaccessiblebutton.cxx @@ -217,7 +217,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyB OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; - vcl::Window* pWindow = GetWindow(); + VclPtr<vcl::Window> pWindow = GetWindow(); if ( pWindow ) { KeyEvent aKeyEvent = pWindow->GetActivationKey(); diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx index c50c827d2e03..9221c10dfa09 100644 --- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx +++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx @@ -234,7 +234,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKe OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; - vcl::Window* pWindow = GetWindow(); + VclPtr<vcl::Window> pWindow = GetWindow(); if ( pWindow ) { KeyEvent aKeyEvent = pWindow->GetActivationKey(); diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx index 68e91f05182d..432315a35aea 100644 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/accessibility/source/standard/vclxaccessibleedit.cxx @@ -79,7 +79,7 @@ void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve sal_Int32 nOldCaretPosition = m_nCaretPosition; m_nCaretPosition = getCaretPosition(); - vcl::Window* pWindow = GetWindow(); + VclPtr<vcl::Window> pWindow = GetWindow(); if (pWindow && pWindow->HasChildPathFocus()) { if (m_nCaretPosition != nOldCaretPosition) @@ -94,7 +94,7 @@ void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve break; case VCLEVENT_EDIT_SELECTIONCHANGED: { - vcl::Window* pWindow = GetWindow(); + VclPtr<vcl::Window> pWindow = GetWindow(); if (pWindow && pWindow->HasChildPathFocus()) { NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() ); @@ -245,7 +245,7 @@ sal_Bool VCLXAccessibleEdit::doAccessibleAction ( sal_Int32 nIndex ) throw (Inde throw IndexOutOfBoundsException(); bool bDoAction = false; - vcl::Window* pWindow = GetWindow(); + VclPtr<vcl::Window> pWindow = GetWindow(); if ( pWindow ) { pWindow->GrabFocus(); diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx index 131cd03ad146..23cae200edc4 100644 --- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx +++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx @@ -193,7 +193,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActio OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; - vcl::Window* pWindow = GetWindow(); + VclPtr<vcl::Window> pWindow = GetWindow(); if ( pWindow ) { KeyEvent aKeyEvent = pWindow->GetActivationKey(); |