basic/source/runtime/runtime.cxx | 3 +++ 1 file changed, 3 insertions(+)
New commits: commit 2333dfd69c2933004834a572c981ca20a0537422 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Jul 10 12:09:37 2020 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Jul 10 16:51:57 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.kagan...@collabora.com> diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 9424482da487..0c9a17369729 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); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits