summaryrefslogtreecommitdiff
path: root/dbaccess
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 /dbaccess
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 'dbaccess')
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx2
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx4
-rw-r--r--dbaccess/source/ui/misc/databaseobjectview.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLine.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx2
8 files changed, 10 insertions, 10 deletions
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index 2a2ddb2cc263..43f4e01c9079 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -264,7 +264,7 @@ sal_Bool SAL_CALL ODBFilter::filter( const Sequence< PropertyValue >& rDescripto
if ( xWindow.is() )
{
SolarMutexGuard aGuard;
- vcl::Window* pFocusWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pFocusWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pFocusWindow )
pFocusWindow->LeaveWait();
}
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 5aa5f4f38f7d..6a60cec27c96 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1327,8 +1327,8 @@ void SbaTableQueryBrowser::implCheckExternalSlot( sal_uInt16 _nId )
if ( !m_xMainToolbar.is() )
return;
- vcl::Window* pToolboxWindow = VCLUnoHelper::GetWindow( m_xMainToolbar );
- ToolBox* pToolbox = dynamic_cast< ToolBox* >( pToolboxWindow );
+ VclPtr<vcl::Window> pToolboxWindow = VCLUnoHelper::GetWindow( m_xMainToolbar );
+ ToolBox* pToolbox = dynamic_cast< ToolBox* >( pToolboxWindow.get() );
OSL_ENSURE( pToolbox, "SbaTableQueryBrowser::implCheckExternalSlot: cannot obtain the toolbox window!" );
// check if we have to hide this item from the toolbox
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx
index 6b91673a704a..d764b507dd45 100644
--- a/dbaccess/source/ui/misc/databaseobjectview.cxx
+++ b/dbaccess/source/ui/misc/databaseobjectview.cxx
@@ -133,7 +133,7 @@ namespace dbaui
// "ThisComponent"-game for the global application Basic.
const Reference< XFrame > xFrame( m_xFrameLoader, UNO_QUERY_THROW );
const Reference< XWindow > xFrameWindow( xFrame->getContainerWindow(), UNO_SET_THROW );
- vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xFrameWindow );
+ VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xFrameWindow );
ENSURE_OR_THROW( pContainerWindow, "no implementation access to the frame's container window!" );
pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
}
diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
index 0bd4d514c74b..1ddeaf5dbcc0 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLine.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
@@ -49,7 +49,7 @@ namespace
*/
Rectangle GetTextPos(const OTableWindow* _pWin, const Point& _aConnPos,const Point& _aDescrLinePos)
{
- OTableWindowListBox* pListBox = _pWin ? _pWin->GetListBox() : nullptr;
+ VclPtr<OTableWindowListBox> pListBox = _pWin ? _pWin->GetListBox() : nullptr;
OSL_ENSURE(_pWin && pListBox, "OConnectionLine::GetSourceTextPos : invalid call !");
Rectangle aReturn;
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 52d2de8844e9..d87cff6e5b79 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -220,7 +220,7 @@ void OJoinTableView::Resize()
m_aScrollOffset.X() = GetHScrollBar().GetThumbPos();
m_aScrollOffset.Y() = GetVScrollBar().GetThumbPos();
- OTableWindow* pCheck = m_aTableMap.begin()->second;
+ VclPtr<OTableWindow> pCheck = m_aTableMap.begin()->second;
Point aRealPos = pCheck->GetPosPixel();
Point aAssumedPos = pCheck->GetData()->GetPosition() - GetScrollOffset();
@@ -1438,7 +1438,7 @@ void OJoinTableView::GrabTabWinFocus()
}
else if (!m_aTableMap.empty() && m_aTableMap.begin()->second && m_aTableMap.begin()->second->IsVisible())
{
- OTableWindow* pFirstWin = m_aTableMap.begin()->second;
+ VclPtr<OTableWindow> pFirstWin = m_aTableMap.begin()->second;
if (pFirstWin->GetListBox())
pFirstWin->GetListBox()->GrabFocus();
else
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 4f26fc9287df..ea8f22f0976e 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -328,7 +328,7 @@ void OSelectionBrowseBox::Init()
EditBrowseBox::Init();
// set the header bar
- BrowserHeader* pNewHeaderBar = CreateHeaderBar(this);
+ VclPtr<BrowserHeader> pNewHeaderBar = CreateHeaderBar(this);
pNewHeaderBar->SetMouseTransparent(false);
SetHeaderBar(pNewHeaderBar);
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
index d4b3a13bb123..cf17ee449068 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
@@ -195,7 +195,7 @@ uno::Reference< awt::XWindow > SAL_CALL LimitBoxController::createItemWindow(
{
uno::Reference< awt::XWindow > xItemWindow;
- vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xParent );
if ( pParent )
{
SolarMutexGuard aSolarMutexGuard;
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 6dac16d1492c..718611b984e1 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -284,7 +284,7 @@ namespace
if (xUIElement.is())
{
Reference< XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY);
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( pWindow && pWindow->HasChildPathFocus() )
{
pWindow->GrabFocusToDocument();