summaryrefslogtreecommitdiffstats
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-25 16:23:17 +0200
committerAndras Timar <andras.timar@collabora.com>2017-02-18 00:45:43 +0100
commit390e951b78288e082361c386ff5c6618d917c333 (patch)
treede4f00b80ba6183f2678d6582d98d65a94b93aa7 /dbaccess
parentTest that patterns are correctly imported for MS binary format (diff)
downloadcore-390e951b78288e082361c386ff5c6618d917c333.tar.gz
core-390e951b78288e082361c386ff5c6618d917c333.zip
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 'dbaccess')
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx4
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx18
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx5
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.cxx2
5 files changed, 12 insertions, 19 deletions
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 74706f5a3889..706a886e5778 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -687,7 +687,7 @@ void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContaine
OSL_ENSURE(_xContainer.is(),"Data source is NULL! -> GPF");
OSL_ENSURE( ( _eType >= E_TABLE ) && ( _eType < E_ELEMENT_TYPE_COUNT ), "OAppDetailPageHelper::fillNames: invalid type!" );
- DBTreeListBox* pList = m_pLists[ _eType ];
+ DBTreeListBox* pList = m_pLists[ _eType ].get();
OSL_ENSURE( pList, "OAppDetailPageHelper::fillNames: you really should create the list before calling this!" );
if ( !pList )
return;
@@ -809,7 +809,7 @@ void OAppDetailPageHelper::elementReplaced(ElementType _eType
SvTreeListEntry* OAppDetailPageHelper::elementAdded(ElementType _eType,const OUString& _rName, const Any& _rObject )
{
SvTreeListEntry* pRet = nullptr;
- DBTreeListBox* pTreeView = m_pLists[_eType];
+ DBTreeListBox* pTreeView = m_pLists[_eType].get();
if( _eType == E_TABLE && pTreeView )
{
pRet = static_cast<OTableTreeListBox*>(pTreeView)->addedTable( _rName );
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index fb0a4d546c33..9b00cfa17a9b 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -452,7 +452,7 @@ namespace dbaui
Reference< XWindow > xWindow = getTopMostContainerWindow();
vcl::Window* pWin = nullptr;
if ( xWindow.is() )
- pWin = VCLUnoHelper::GetWindow(xWindow);
+ pWin = VCLUnoHelper::GetWindow(xWindow).get();
if ( !pWin )
pWin = getView()->Window::GetParent();
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index d87cff6e5b79..f08beeefdb3a 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -892,8 +892,8 @@ void OJoinTableView::SelectConn(OTableConnection* pConn)
OTableWindow* pConnDest = pConn->GetDestWin();
if (pConnSource && pConnDest)
{
- OTableWindowListBox* pSourceBox = pConnSource->GetListBox();
- OTableWindowListBox* pDestBox = pConnDest->GetListBox();
+ OTableWindowListBox* pSourceBox = pConnSource->GetListBox().get();
+ OTableWindowListBox* pDestBox = pConnDest->GetListBox().get();
if (pSourceBox && pDestBox)
{
pSourceBox->SelectAll(false);
@@ -1200,12 +1200,8 @@ OTableConnection* OJoinTableView::GetTabConn(const OTableWindow* pLhs,const OTab
if ((!pLhs || pLhs->ExistsAConn()) && (!pRhs || pRhs->ExistsAConn()))
{
- auto aIter = m_vTableConnection.begin();
- auto aEnd = m_vTableConnection.end();
- for(;aIter != aEnd;++aIter)
+ for(VclPtr<OTableConnection> const & pData : m_vTableConnection)
{
- OTableConnection* pData = *aIter;
-
if ( ( (pData->GetSourceWin() == pLhs)
&& ( (pData->GetDestWin() == pRhs)
|| (nullptr == pRhs)
@@ -1287,10 +1283,10 @@ bool OJoinTableView::PreNotify(NotifyEvent& rNEvt)
{
if ((aIter->second == m_aTableMap.rbegin()->second) && bForward)
// the last win is active and we're travelling forward -> select the first conn
- pNextConn = *m_vTableConnection.begin();
+ pNextConn = m_vTableConnection.begin()->get();
if ((aIter == m_aTableMap.begin()) && !bForward)
// the first win is active an we're traveling backward -> select the last conn
- pNextConn = *m_vTableConnection.rbegin();
+ pNextConn = m_vTableConnection.rbegin()->get();
}
if (!pNextConn)
@@ -1343,11 +1339,11 @@ bool OJoinTableView::PreNotify(NotifyEvent& rNEvt)
// no win for any reason -> select the next or previous conn
if (i < (sal_Int32)m_vTableConnection.size())
// there is a currently active conn
- pNextConn = m_vTableConnection[(i + (bForward ? 1 : m_vTableConnection.size() - 1)) % m_vTableConnection.size()];
+ pNextConn = m_vTableConnection[(i + (bForward ? 1 : m_vTableConnection.size() - 1)) % m_vTableConnection.size()].get();
else
{ // no tab win selected, no conn selected
if (!m_vTableConnection.empty())
- pNextConn = m_vTableConnection[bForward ? 0 : m_vTableConnection.size() - 1];
+ pNextConn = m_vTableConnection[bForward ? 0 : m_vTableConnection.size() - 1].get();
else if (!m_aTableMap.empty())
{
if(bForward)
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index f0c4fbc75d0f..f0dd20842eb6 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -171,11 +171,8 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
OTableWindow* pSourceWin = jxdSource.pListBox->GetTabWin();
OTableWindow* pDestWin = jxdDest.pListBox->GetTabWin();
- auto aIter = getTableConnections().begin();
- auto aEnd = getTableConnections().end();
- for(;aIter != aEnd;++aIter)
+ for(VclPtr<OTableConnection> const & pFirst : getTableConnections())
{
- OTableConnection* pFirst = *aIter;
if((pFirst->GetSourceWin() == pSourceWin && pFirst->GetDestWin() == pDestWin) ||
(pFirst->GetSourceWin() == pDestWin && pFirst->GetDestWin() == pSourceWin))
{
diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx b/dbaccess/source/ui/uno/ColumnControl.cxx
index 580dc1ca6ec8..0fbe95b96031 100644
--- a/dbaccess/source/ui/uno/ColumnControl.cxx
+++ b/dbaccess/source/ui/uno/ColumnControl.cxx
@@ -70,7 +70,7 @@ void SAL_CALL OColumnControl::createPeer(const Reference< XToolkit >& /*rToolkit
{
VCLXWindow* pParent = VCLXWindow::GetImplementation(rParentPeer);
if (pParent)
- pParentWin = pParent->GetWindow();
+ pParentWin = pParent->GetWindow().get();
}
OColumnPeer* pPeer = new OColumnPeer( pParentWin, m_xContext );