[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - basic/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 14 14:52:14 UTC 2020
basic/source/runtime/runtime.cxx | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit 9a917ee5f7ed2e8476e90a03bf996830b9a88db7
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Jul 10 12:09:37 2020 +0300
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jul 14 16:51:39 2020 +0200
tdf#134692: copy deep when there are multiple references to the old array
E.g., when we redim a copy of an array, the other copy would still have
its old dimensions, so shallow copy would share some array elements
between the now different arrays.
The other possible approach would be to try to modify the original array
to have the ByRef semantics.
Change-Id: Iab272ecbf4ade67048d6a126f17322441c5aa808
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98481
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
(cherry picked from commit 2333dfd69c2933004834a572c981ca20a0537422)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98637
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index c2182e26b77a..0b603228fca9 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -2201,6 +2201,9 @@ static void implCopyDimArray( SbxDimArray* pNewArray, SbxDimArray* pOldArray, sa
else
{
SbxVariable* pSource = pOldArray->Get32( pActualIndices );
+ if (pSource && pOldArray->GetRefCount() > 1)
+ // tdf#134692: old array will stay alive after the redim - we need to copy deep
+ pSource = new SbxVariable(*pSource);
pNewArray->Put32(pSource, pActualIndices);
}
}
More information about the Libreoffice-commits
mailing list