diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-25 16:23:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-29 06:45:42 +0000 |
commit | e6ffb539ee232ea0c679928ff456c1cf97429f63 (patch) | |
tree | e4b71a9bd49edba1a0f1c95f60f6da81433d1983 /framework | |
parent | bbc7ed9c379019f31dc7ac234cf83ea151601465 (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>
Diffstat (limited to 'framework')
4 files changed, 12 insertions, 12 deletions
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 83fc164c4805..756205886d34 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -711,7 +711,7 @@ void LayoutManager::implts_writeWindowStateData( const OUString& aName, const UI // Retrieve output size from container Window SolarMutexGuard aGuard; - pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); + pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ).get(); if ( pContainerWindow ) aContainerWinSize = pContainerWindow->GetOutputSizePixel(); diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index b770fd8a86e0..98cbacebeb02 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -817,7 +817,7 @@ bool ToolbarLayoutManager::dockToolbar( const OUString& rResourceURL, ui::Dockin { SolarMutexGuard aGuard; - pWindow = VCLUnoHelper::GetWindow( xWindow ); + pWindow = VCLUnoHelper::GetWindow( xWindow ).get(); if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) { pToolBox = static_cast<ToolBox *>(pWindow); @@ -1410,7 +1410,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno { { SolarMutexGuard aGuard; - pWindow = VCLUnoHelper::GetWindow( xWindow ); + pWindow = VCLUnoHelper::GetWindow( xWindow ).get(); if ( pWindow ) { OUString aText = pWindow->GetText(); @@ -2251,7 +2251,7 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre { // Retrieve output size from container Window SolarMutexGuard aGuard; - pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow ); + pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow ).get(); if ( pDockingWindow ) aDockingWinSize = pDockingWindow->GetOutputSizePixel(); } @@ -2589,7 +2589,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( SolarMutexResettableGuard aReadLock; uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); ::Size aContainerWinSize; - vcl::Window* pContainerWindow( nullptr ); + vcl::Window* pContainerWindow( nullptr ); ::Rectangle aDockingAreaOffsets( m_aDockingAreaOffsets ); aReadLock.clear(); @@ -2602,7 +2602,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( { // Retrieve output size from container Window SolarMutexGuard aGuard; - pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ).get(); aContainerWinSize = pContainerWindow->GetOutputSizePixel(); } @@ -2629,7 +2629,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( { SolarMutexGuard aGuard; - pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); + pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ).get(); VclPtr<vcl::Window> pDockWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pDockWindow && pDockWindow->GetType() == WINDOW_TOOLBOX ) pToolBox = static_cast<ToolBox *>(pDockWindow.get()); @@ -3067,7 +3067,7 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d vcl::Window* pDockingAreaWindow( nullptr ); { SolarMutexGuard aGuard; - pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); + pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ).get(); VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); nDockPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( ::Point( 0, nPosY ))).Y(); } @@ -3262,7 +3262,7 @@ throw (uno::RuntimeException, std::exception) ::Point aMousePos; { SolarMutexGuard aGuard; - pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ).get(); aMousePos = pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y )); } @@ -3631,7 +3631,7 @@ throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; xWindow.set( e.Source, uno::UNO_QUERY ); - pWindow = VCLUnoHelper::GetWindow( xWindow ); + pWindow = VCLUnoHelper::GetWindow( xWindow ).get(); if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) pToolBox = static_cast<ToolBox *>(pWindow); diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx index 4de793340e67..0214754d0dca 100644 --- a/framework/source/uielement/addonstoolbarwrapper.cxx +++ b/framework/source/uielement/addonstoolbarwrapper.cxx @@ -105,7 +105,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument if ( xFrame.is() && m_aConfigData.getLength() > 0 ) { // Create VCL based toolbar which will be filled with settings data - ToolBox* pToolBar = nullptr; + VclPtr<ToolBox> pToolBar; AddonsToolBarManager* pToolBarManager = nullptr; { SolarMutexGuard aSolarMutexGuard; diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index 8733666c047b..288294ada9ac 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -141,7 +141,7 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) th if ( xFrame.is() && m_xConfigSource.is() ) { // Create VCL based toolbar which will be filled with settings data - ToolBox* pToolBar = nullptr; + VclPtr<ToolBox> pToolBar; ToolBarManager* pToolBarManager = nullptr; { SolarMutexGuard aSolarMutexGuard; |