summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-11-07 21:41:32 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-11-08 10:01:24 +0100
commitb3c77dd04deb9b4336e2a1bd88afdfb170b585a0 (patch)
treebf97b33a76464a2a7ae9b3f1ae1528c403ea9689 /sc
parent68d370ddf14455a31898b5e456ab2b4d64ae9e51 (diff)
coverity#1440238 silence Wrapper object use after free
Change-Id: Iaf371360239ca07f45e76530c7d8e497b2ef697f Reviewed-on: https://gerrit.libreoffice.org/63049 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/dpobject.hxx2
-rw-r--r--sc/source/core/data/dpobject.cxx3
-rw-r--r--sc/source/filter/excel/xipivot.cxx3
3 files changed, 4 insertions, 4 deletions
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index eb5467d30479..9be63f26db36 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -392,7 +392,7 @@ public:
OUString CreateNewName() const;
void FreeTable(const ScDPObject* pDPObj);
- SC_DLLPUBLIC void InsertNewTable(std::unique_ptr<ScDPObject> pDPObj);
+ SC_DLLPUBLIC ScDPObject* InsertNewTable(std::unique_ptr<ScDPObject> pDPObj);
SC_DLLPUBLIC bool HasTable(const ScDPObject* pDPObj) const;
SC_DLLPUBLIC SheetCaches& GetSheetCaches();
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index ac243511b5f4..d9b6347a89d7 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -3774,7 +3774,7 @@ void ScDPCollection::FreeTable(const ScDPObject* pDPObject)
maTables.erase(std::remove_if(maTables.begin(), maTables.end(), funcRemoveCondition), maTables.end());
}
-void ScDPCollection::InsertNewTable(std::unique_ptr<ScDPObject> pDPObj)
+ScDPObject* ScDPCollection::InsertNewTable(std::unique_ptr<ScDPObject> pDPObj)
{
const ScRange& rOutRange = pDPObj->GetOutRange();
const ScAddress& s = rOutRange.aStart;
@@ -3782,6 +3782,7 @@ void ScDPCollection::InsertNewTable(std::unique_ptr<ScDPObject> pDPObj)
mpDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), ScMF::DpTable);
maTables.push_back(std::move(pDPObj));
+ return maTables.back().get();
}
bool ScDPCollection::HasTable(const ScDPObject* pDPObj) const
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index 90d512546980..2d84290e4288 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -1490,8 +1490,7 @@ void XclImpPivotTable::Convert()
pDPObj->SetOutRange( aOutRange );
pDPObj->SetHeaderLayout( maPTViewEx9Info.mnGridLayout == 0 );
- mpDPObj = pDPObj.get();
- GetDoc().GetDPCollection()->InsertNewTable(std::move(pDPObj));
+ mpDPObj = GetDoc().GetDPCollection()->InsertNewTable(std::move(pDPObj));
ApplyFieldInfo();
ApplyMergeFlags(aOutRange, aSaveData);