[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 12 13:37:54 UTC 2021
sw/source/core/doc/docfmt.cxx | 9 +++++++++
1 file changed, 9 insertions(+)
New commits:
commit 332f5479ec30588305b9077eed81a644bbb5d4e8
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Apr 9 16:40:01 2021 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Apr 12 15:37:21 2021 +0200
sw style copy: fix crash when handling a conditional paragraphy style
- "Text body" is normally a conditional style for a full-blown, default
SwDoc
- SwTransferable::GetData() creates a temporary, stripped down SwDoc,
which has a "Text body" style, but it's not conditional
- SwDoc::CopyFormatArr() assumes that in case the target already has a
style with a given name, then either both the source and destination
styles are conditional, or neither
- in practice this only causes a crash if the style is customized, as we
skip default styles, probably that's why this was not noticed so far
The Online case invokes this as part of
lok::Document::getSelectionType(), so it was enough to set the paragraph
style to Text body and then select some of that text (with a suitable
document) to hit this.
Based on a patch from Michael Meeks, thanks for that.
(cherry picked from commit ce98bef935dccd79735615a9299b2aa7a1ab0b94)
Conflicts:
sw/qa/extras/tiledrendering/tiledrendering.cxx
Change-Id: Ic3c27ec582ae1745469042856254313cbc996ee0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113970
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index f7a11676594e..e61d27c6a961 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1328,9 +1328,18 @@ void SwDoc::CopyFormatArr( const SwFormatsBase& rSourceArr,
//FEATURE::CONDCOLL
if( RES_CONDTXTFMTCOLL == pSrc->Which() )
+ {
+ if (pDstColl->Which() != RES_CONDTXTFMTCOLL)
+ {
+ // Target already had a style with a matching name, but it's not a conditional
+ // style, then don't copy the conditions.
+ continue;
+ }
+
// Copy the conditions, but delete the old ones first!
static_cast<SwConditionTextFormatColl*>(pDstColl)->SetConditions(
static_cast<SwConditionTextFormatColl*>(pSrc)->GetCondColls() );
+ }
//FEATURE::CONDCOLL
}
}
More information about the Libreoffice-commits
mailing list