From 328d0fcbe2a9dbcb3431d6142073bfe0ea6792cb Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Mon, 15 Aug 2016 21:23:18 +0200 Subject: Resolves: tdf#100852 update miBroadcasterPos before copying it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9ab9acfb0871355ceb2c3c83f51e7ba05a74d8f2 (cherry picked from commit 7b768dd9a78d2a979eb4d1b1b5b33a4f01a1a98a) Reviewed-on: https://gerrit.libreoffice.org/28151 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sc/source/core/data/column.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index fdecc5f5ab7e..bb1f56431418 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1510,7 +1510,27 @@ public: ~CopyByCloneHandler() { if (mpDestPos) + { + // If broadcasters were setup in the same column, + // maDestPos.miBroadcasterPos doesn't match + // mrDestCol.maBroadcasters because it is never passed anywhere. + // Assign a corresponding iterator before copying all over. + // Otherwise this may result in wrongly copying a singular + // iterator. + + { + /* XXX Using a temporary ColumnBlockPosition just for + * initializing from ScColumn::maBroadcasters.begin() is ugly, + * on the other hand we don't want to expose + * ScColumn::maBroadcasters to the outer world and have a + * getter. */ + sc::ColumnBlockPosition aTempBlock; + mrDestCol.InitBlockPosition(aTempBlock); + maDestPos.miBroadcasterPos = aTempBlock.miBroadcasterPos; + } + *mpDestPos = maDestPos; + } } void setStartListening( bool b ) -- cgit v1.2.3