diff options
author | Eike Rathke <erack@redhat.com> | 2018-09-20 18:12:03 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-09-26 12:46:31 +0200 |
commit | cd81c31a6c5313c53269721749f7bcdc11a103ad (patch) | |
tree | 57eee74be9725fe3d1b2035a21d4a3d446898745 | |
parent | 07c710d86d99297061269a40a3b9f266b92e434a (diff) |
Resolves: tdf#119954 do not copy the old parent, init with new parent instead
The parent is always the ScDBCollection that contains the
ScDBCollection::NamedDBs container, not the one the
ScDBCollection::NamedDBs was copy-constructed from.
Change-Id: Ia409347f3aeb9ad7a5e68da7af727adfac98d6a2
Reviewed-on: https://gerrit.libreoffice.org/60833
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit 7ea5d339dc4d8412f436f3affa589bfbd0b1ef68)
Reviewed-on: https://gerrit.libreoffice.org/60841
Tested-by: Eike Rathke <erack@redhat.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/inc/dbdata.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/tool/dbdata.cxx | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index 4523bb64c206..ab0cf85b9cb4 100644 --- a/sc/inc/dbdata.hxx +++ b/sc/inc/dbdata.hxx @@ -240,7 +240,8 @@ public: DBsType m_DBs; ScDBCollection& mrParent; NamedDBs(ScDBCollection& rParent, ScDocument& rDoc); - NamedDBs(const NamedDBs& r); + NamedDBs(const NamedDBs& r, ScDBCollection& rParent); + NamedDBs(const NamedDBs&) = delete; virtual ~NamedDBs() override; NamedDBs & operator=(NamedDBs const&) = delete; void initInserted( ScDBData* p ); diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index 4c331d839664..66a0d1922eee 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -1071,9 +1071,9 @@ ScRangeList& ScDBDataContainerBase::GetDirtyTableColumnNames() ScDBCollection::NamedDBs::NamedDBs(ScDBCollection& rParent, ScDocument& rDoc) : ScDBDataContainerBase(rDoc), mrParent(rParent) {} -ScDBCollection::NamedDBs::NamedDBs(const NamedDBs& r) +ScDBCollection::NamedDBs::NamedDBs(const NamedDBs& r, ScDBCollection& rParent) : ScDBDataContainerBase(r.mrDoc) - , mrParent(r.mrParent) + , mrParent(rParent) { for (auto const& it : r.m_DBs) { @@ -1287,7 +1287,7 @@ ScDBCollection::ScDBCollection(ScDocument* pDocument) : pDoc(pDocument), nEntryIndex(1), maNamedDBs(*this, *pDocument) {} ScDBCollection::ScDBCollection(const ScDBCollection& r) : - pDoc(r.pDoc), nEntryIndex(r.nEntryIndex), maNamedDBs(r.maNamedDBs), maAnonDBs(r.maAnonDBs) {} + pDoc(r.pDoc), nEntryIndex(r.nEntryIndex), maNamedDBs(r.maNamedDBs, *this), maAnonDBs(r.maAnonDBs) {} const ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const { |