Kaydet (Commit) b3c77dd0 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1440238 silence Wrapper object use after free

Change-Id: Iaf371360239ca07f45e76530c7d8e497b2ef697f
Reviewed-on: https://gerrit.libreoffice.org/63049
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 68d370dd
...@@ -392,7 +392,7 @@ public: ...@@ -392,7 +392,7 @@ public:
OUString CreateNewName() const; OUString CreateNewName() const;
void FreeTable(const ScDPObject* pDPObj); 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 bool HasTable(const ScDPObject* pDPObj) const;
SC_DLLPUBLIC SheetCaches& GetSheetCaches(); SC_DLLPUBLIC SheetCaches& GetSheetCaches();
......
...@@ -3774,7 +3774,7 @@ void ScDPCollection::FreeTable(const ScDPObject* pDPObject) ...@@ -3774,7 +3774,7 @@ void ScDPCollection::FreeTable(const ScDPObject* pDPObject)
maTables.erase(std::remove_if(maTables.begin(), maTables.end(), funcRemoveCondition), maTables.end()); 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 ScRange& rOutRange = pDPObj->GetOutRange();
const ScAddress& s = rOutRange.aStart; const ScAddress& s = rOutRange.aStart;
...@@ -3782,6 +3782,7 @@ void ScDPCollection::InsertNewTable(std::unique_ptr<ScDPObject> pDPObj) ...@@ -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); mpDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), ScMF::DpTable);
maTables.push_back(std::move(pDPObj)); maTables.push_back(std::move(pDPObj));
return maTables.back().get();
} }
bool ScDPCollection::HasTable(const ScDPObject* pDPObj) const bool ScDPCollection::HasTable(const ScDPObject* pDPObj) const
......
...@@ -1490,8 +1490,7 @@ void XclImpPivotTable::Convert() ...@@ -1490,8 +1490,7 @@ void XclImpPivotTable::Convert()
pDPObj->SetOutRange( aOutRange ); pDPObj->SetOutRange( aOutRange );
pDPObj->SetHeaderLayout( maPTViewEx9Info.mnGridLayout == 0 ); pDPObj->SetHeaderLayout( maPTViewEx9Info.mnGridLayout == 0 );
mpDPObj = pDPObj.get(); mpDPObj = GetDoc().GetDPCollection()->InsertNewTable(std::move(pDPObj));
GetDoc().GetDPCollection()->InsertNewTable(std::move(pDPObj));
ApplyFieldInfo(); ApplyFieldInfo();
ApplyMergeFlags(aOutRange, aSaveData); ApplyMergeFlags(aOutRange, aSaveData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment