summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-09-20 18:12:03 +0200
committerAndras Timar <andras.timar@collabora.com>2018-11-13 21:06:22 +0100
commitf712c91f34534462feba5a4a9217122ce332a671 (patch)
tree7aafc679117e63f364f07f41d4d8da0831040786
parent46c0aca3e53a26219ed14e83b603a13d486ed5c5 (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) (cherry picked from commit 3298d3c68fa17b350ef7bec8271fcfc673b5e1a7) (cherry picked from commit 15ce830eb8994bf1c01389b53c05aed7ed9daba4)
-rw-r--r--sc/inc/dbdata.hxx3
-rw-r--r--sc/source/core/tool/dbdata.cxx6
2 files changed, 5 insertions, 4 deletions
diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index df6b88d4dbb9..27a7cb77b4ac 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -241,7 +241,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 1d62a479981b..31c1977ca064 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)
{
@@ -1288,7 +1288,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
{