Resolves: rhbz#1080196 mdds/multi_type_vector_itr.hpp update_node(): soffice.bin killed by SIGSEGV

f41
David Tardon 11 years ago
parent fb9ee009ae
commit c549d52cd7

@ -0,0 +1,170 @@
From e91bacdb67e0993d476611260cdcda9e49b4054a Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@collabora.com>
Date: Fri, 28 Mar 2014 20:50:29 -0400
Subject: [PATCH] rhbz#1080196: Delete the destination first then paste.
Deleting in-between pasting was causing the block iterators to become
invalid when the deletion took place, which resulted in a segfault.
Also cleaned up the bits about handling filtered rows. It was using the
old row flag which is empty these days (so it never would have worked).
Plus we do bail out earlier if the destination contains a filtered row.
Change-Id: I78d3ee8bce1647c1c8685f92a3df3c38cc014811
---
sc/source/core/data/document.cxx | 101 +++++++++++++--------------------------
1 file changed, 32 insertions(+), 69 deletions(-)
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index ab39965..fe5572f 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2761,21 +2761,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
SetAutoCalc( bOldAutoCalc );
}
-static SCROW lcl_getLastNonFilteredRow(
- const ScBitMaskCompressedArray<SCROW, sal_uInt8>& rFlags, SCROW nBegRow, SCROW nEndRow,
- SCROW nRowCount)
-{
- SCROW nFilteredRow = rFlags.GetFirstForCondition(
- nBegRow, nEndRow, CR_FILTERED, CR_FILTERED);
-
- SCROW nRow = nFilteredRow - 1;
- if (nRow - nBegRow + 1 > nRowCount)
- // make sure the row range stays within the data size.
- nRow = nBegRow + nRowCount - 1;
-
- return nRow;
-}
-
void ScDocument::CopyMultiRangeFromClip(
const ScAddress& rDestPos, const ScMarkData& rMark, sal_uInt16 nInsFlag, ScDocument* pClipDoc,
bool bResetCut, bool bAsLink, bool /*bIncludeFiltered*/, bool bSkipAttrForEmpty)
@@ -2787,83 +2772,62 @@ void ScDocument::CopyMultiRangeFromClip(
// There is nothing in the clip doc to copy.
return;
- bool bOldAutoCalc = GetAutoCalc();
- SetAutoCalc( false ); // avoid multiple recalculations
+ // Right now, we don't allow pasting into filtered rows, so we don't even handle it here.
+ sc::AutoCalcSwitch aACSwitch(*this, false); // turn of auto calc temporarily.
NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc);
+ ScRange aDestRange;
+ rMark.GetMarkArea(aDestRange);
+
+ bInsertingFromOtherDoc = true; // kein Broadcast/Listener aufbauen bei Insert
+
SCCOL nCol1 = rDestPos.Col();
SCROW nRow1 = rDestPos.Row();
ScClipParam& rClipParam = pClipDoc->GetClipParam();
+ if (!bSkipAttrForEmpty)
+ {
+ // Do the deletion first.
+ sal_uInt16 nDelFlag = IDF_CONTENTS;
+ SCCOL nColSize = rClipParam.getPasteColSize();
+ SCROW nRowSize = rClipParam.getPasteRowSize();
+
+ DeleteArea(nCol1, nRow1, nCol1+nColSize-1, nRow1+nRowSize-1, rMark, nDelFlag);
+ }
+
sc::CopyFromClipContext aCxt(*this, NULL, pClipDoc, nInsFlag, bAsLink, bSkipAttrForEmpty);
std::pair<SCTAB,SCTAB> aTabRanges = getMarkedTableRange(maTabs, rMark);
aCxt.setTabRange(aTabRanges.first, aTabRanges.second);
- ScRange aDestRange;
- rMark.GetMarkArea(aDestRange);
- SCROW nLastMarkedRow = aDestRange.aEnd.Row();
-
- bInsertingFromOtherDoc = true; // kein Broadcast/Listener aufbauen bei Insert
-
- SCROW nBegRow = nRow1;
- sal_uInt16 nDelFlag = IDF_CONTENTS;
- const ScBitMaskCompressedArray<SCROW, sal_uInt8>& rFlags = GetRowFlagsArray(aCxt.getTabStart());
-
- for ( size_t i = 0, n = rClipParam.maRanges.size(); i < n; ++i )
+ for (size_t i = 0, n = rClipParam.maRanges.size(); i < n; ++i)
{
- ScRange* p = rClipParam.maRanges[ i ];
- // The begin row must not be filtered.
+ ScRange* p = rClipParam.maRanges[i];
SCROW nRowCount = p->aEnd.Row() - p->aStart.Row() + 1;
-
SCsCOL nDx = static_cast<SCsCOL>(nCol1 - p->aStart.Col());
- SCsROW nDy = static_cast<SCsROW>(nBegRow - p->aStart.Row());
+ SCsROW nDy = static_cast<SCsROW>(nRow1 - p->aStart.Row());
SCCOL nCol2 = nCol1 + p->aEnd.Col() - p->aStart.Col();
+ SCROW nEndRow = nRow1 + nRowCount - 1;
- SCROW nEndRow = lcl_getLastNonFilteredRow(rFlags, nBegRow, nLastMarkedRow, nRowCount);
-
- if (!bSkipAttrForEmpty)
- DeleteArea(nCol1, nBegRow, nCol2, nEndRow, rMark, nDelFlag);
+ CopyBlockFromClip(aCxt, nCol1, nRow1, nCol2, nEndRow, rMark, nDx, nDy);
- CopyBlockFromClip(aCxt, nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy);
- nRowCount -= nEndRow - nBegRow + 1;
-
- while (nRowCount > 0)
+ switch (rClipParam.meDirection)
{
- // Get the first non-filtered row.
- SCROW nNonFilteredRow = rFlags.GetFirstForCondition(nEndRow+1, nLastMarkedRow, CR_FILTERED, 0);
- if (nNonFilteredRow > nLastMarkedRow)
- return;
-
- SCROW nRowsSkipped = nNonFilteredRow - nEndRow - 1;
- nDy += nRowsSkipped;
-
- nBegRow = nNonFilteredRow;
- nEndRow = lcl_getLastNonFilteredRow(rFlags, nBegRow, nLastMarkedRow, nRowCount);
-
- if (!bSkipAttrForEmpty)
- DeleteArea(nCol1, nBegRow, nCol2, nEndRow, rMark, nDelFlag);
-
- CopyBlockFromClip(aCxt, nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy);
- nRowCount -= nEndRow - nBegRow + 1;
+ case ScClipParam::Row:
+ // Begin row for the next range being pasted.
+ nRow1 += nRowCount;
+ break;
+ case ScClipParam::Column:
+ nCol1 += p->aEnd.Col() - p->aStart.Col() + 1;
+ break;
+ default:
+ ;
}
-
- if (rClipParam.meDirection == ScClipParam::Row)
- // Begin row for the next range being pasted.
- nBegRow = rFlags.GetFirstForCondition(nEndRow+1, nLastMarkedRow, CR_FILTERED, 0);
- else
- nBegRow = nRow1;
-
- if (rClipParam.meDirection == ScClipParam::Column)
- nCol1 += p->aEnd.Col() - p->aStart.Col() + 1;
}
bInsertingFromOtherDoc = false;
- ScRangeList aRanges;
- aRanges.Append(aDestRange);
-
// Listener aufbauen nachdem alles inserted wurde
StartListeningFromClip(aDestRange.aStart.Col(), aDestRange.aStart.Row(),
aDestRange.aEnd.Col(), aDestRange.aEnd.Row(), rMark, nInsFlag );
@@ -2873,7 +2837,6 @@ void ScDocument::CopyMultiRangeFromClip(
if (bResetCut)
pClipDoc->GetClipParam().mbCutMode = false;
- SetAutoCalc( bOldAutoCalc );
}
void ScDocument::SetClipArea( const ScRange& rArea, bool bCut )
--
1.9.0

@ -43,7 +43,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice Name: libreoffice
Epoch: 1 Epoch: 1
Version: %{libo_version}.2 Version: %{libo_version}.2
Release: 1%{?libo_prerelease}%{?dist} Release: 2%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0
Group: Applications/Productivity Group: Applications/Productivity
URL: http://www.libreoffice.org/default/ URL: http://www.libreoffice.org/default/
@ -286,6 +286,7 @@ Patch23: 0001-Related-rhbz-1076264-intermittent-a11y-crash-in-calc.patch
Patch24: 0001-Resolves-rhbz-1077780-crash-on-loading-.docx.patch Patch24: 0001-Resolves-rhbz-1077780-crash-on-loading-.docx.patch
Patch25: 0001-Change-SDK-javaodc-from-static-Package-to-dynamic-Ge.patch Patch25: 0001-Change-SDK-javaodc-from-static-Package-to-dynamic-Ge.patch
Patch26: 0001-Package-GeneratedPackage-fixup.patch Patch26: 0001-Package-GeneratedPackage-fixup.patch
Patch27: 0001-rhbz-1080196-Delete-the-destination-first-then-paste.patch
%define instdir %{_libdir} %define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice %define baseinstdir %{instdir}/libreoffice
@ -2175,6 +2176,10 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif %endif
%changelog %changelog
* Mon Mar 31 2014 David Tardon <dtardon@redhat.com> - 1:4.2.3.2-2
- Resolves: rhbz#1080196 mdds/multi_type_vector_itr.hpp update_node():
soffice.bin killed by SIGSEGV
* Wed Mar 26 2014 David Tardon <dtardon@redhat.com> - 1:4.2.3.2-1 * Wed Mar 26 2014 David Tardon <dtardon@redhat.com> - 1:4.2.3.2-1
- update to 4.2.3 rc2 - update to 4.2.3 rc2

Loading…
Cancel
Save