diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-25 16:23:17 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-02-18 00:45:43 +0100 |
commit | 390e951b78288e082361c386ff5c6618d917c333 (patch) | |
tree | de4f00b80ba6183f2678d6582d98d65a94b93aa7 /basctl | |
parent | 599719217423e8468cc54cc74e7850b8a867120b (diff) |
loplugin:vclwidgets check for assigning from VclPt<T> to T*
Inspired by a recent bug report where we were assigning the result
of VclPtr<T>::Create to a raw pointer.
As a consequence, we also need to change various methods that were
returning newly created Window subclasses via raw pointer, to
instead return those via VclPtr
Change-Id: I8118e0195a5b2b4780e646cfb0e151692e54ae2b
Reviewed-on: https://gerrit.libreoffice.org/31318
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit e6ffb539ee232ea0c679928ff456c1cf97429f63)
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/accessibility/accessibledialogcontrolshape.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/basidesh.cxx | 13 | ||||
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 2 |
3 files changed, 7 insertions, 10 deletions
diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index 05e16b6e3d17..ade2d1b2960d 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -176,7 +176,7 @@ vcl::Window* AccessibleDialogControlShape::GetWindow() const { Reference< awt::XControl > xControl( m_pDlgEdObj->GetControl(), UNO_QUERY ); if ( xControl.is() ) - pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ); + pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ).get(); } return pWindow; diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index bcbbf46358fd..b8ad85cd725b 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -313,9 +313,8 @@ void Shell::onDocumentClosed( const ScriptDocument& _rDocument ) } } // delete windows outside main loop so we don't invalidate the original iterator - for (auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it) + for (VclPtr<BaseWindow> const & pWin : aDeleteVec) { - BaseWindow* pWin = *it; pWin->StoreData(); if ( pWin == pCurWin ) bSetCurWindow = true; @@ -440,7 +439,7 @@ void Shell::OuterResizePixel( const Point &rPos, const Size &rSize ) IMPL_LINK( Shell, TabBarHdl, ::TabBar *, pCurTabBar, void ) { sal_uInt16 nCurId = pCurTabBar->GetCurPageId(); - BaseWindow* pWin = aWindowTable[ nCurId ]; + BaseWindow* pWin = aWindowTable[ nCurId ].get(); DBG_ASSERT( pWin, "Eintrag in TabBar passt zu keinem Fenster!" ); SetCurWindow( pWin ); } @@ -559,9 +558,8 @@ void Shell::CheckWindows() if ( pWin->GetStatus() & BASWIN_TOBEKILLED ) aDeleteVec.push_back( pWin ); } - for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it ) + for ( VclPtr<BaseWindow> const & pWin : aDeleteVec ) { - BaseWindow* pWin = *it; pWin->StoreData(); if ( pWin == pCurWin ) bSetCurWindow = true; @@ -582,9 +580,8 @@ void Shell::RemoveWindows( const ScriptDocument& rDocument, const OUString& rLib if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName ) aDeleteVec.push_back( pWin ); } - for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it ) + for ( VclPtr<BaseWindow> const & pWin : aDeleteVec ) { - BaseWindow* pWin = *it; if ( pWin == pCurWin ) bChangeCurWindow = true; pWin->StoreData(); @@ -737,7 +734,7 @@ void Shell::UpdateWindows() { if ( !pNextActiveWindow ) { - pNextActiveWindow = FindApplicationWindow(); + pNextActiveWindow = FindApplicationWindow().get(); } SetCurWindow( pNextActiveWindow, true ); } diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 5b0f9debc066..337d44021411 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -585,7 +585,7 @@ void TabBar::Sort() sal_uInt16 nId = GetPageId( i ); aTabBarSortHelper.nPageId = nId; aTabBarSortHelper.aPageText = GetPageText( nId ); - BaseWindow* pWin = aWindowTable[ nId ]; + BaseWindow* pWin = aWindowTable[ nId ].get(); if (dynamic_cast<ModulWindow*>(pWin)) { |