summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-10-03 23:04:41 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-10-04 08:21:57 +0200
commit3aff88ae021c571b6e218f6e2a0f62728bb86394 (patch)
tree522d5ddff245fd3fedd1f43fa98334da6400029e /sw/inc
parent4a2a94d3f41bfcf13ca96027e0bb266a429a56c7 (diff)
tdf#151094 ODT export: fix crash when linked paragraph style is deleted
If a document contains a linked paragraph-character style pair and the paragraph style gets deleted, we crash on save. Commit 3227975c0f42ff23d528f5ab94b4538c8af764c (sw: paragraph styles: add doc model & UNO API for a linked character style, 2021-09-24) added support for linked para/char styles, but it failed to get the lifecycle correctly when it comes to deleting these styles. Fix the dangling para/char style references by explicitly looking what styles may refer to us and clear their references. An alternative would be to clear the "link" pointer of our own "link" pointer only, but broken documents may e.g. link multiple paragraph styles to a single character style, so this is probably not enough. Change-Id: I9465d43e90cf54c3c02bffda3e7c75b52c543a65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140930 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/charfmt.hxx3
-rw-r--r--sw/inc/fmtcol.hxx2
2 files changed, 3 insertions, 2 deletions
diff --git a/sw/inc/charfmt.hxx b/sw/inc/charfmt.hxx
index e08d2f5f3a3f..84571d26263a 100644
--- a/sw/inc/charfmt.hxx
+++ b/sw/inc/charfmt.hxx
@@ -36,10 +36,11 @@ class SW_DLLPUBLIC SwCharFormat final : public SwFormat
{}
public:
+ ~SwCharFormat();
void dumpAsXml(xmlTextWriterPtr pWriter) const;
- void SetLinkedParaFormat(SwTextFormatColl& rLink);
+ void SetLinkedParaFormat(SwTextFormatColl* pLink);
const SwTextFormatColl* GetLinkedParaFormat() const;
};
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index b5706dc0761b..00e5208b73f4 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -103,7 +103,7 @@ public:
inline void SetNextTextFormatColl(SwTextFormatColl& rNext);
SwTextFormatColl& GetNextTextFormatColl() const { return *mpNextTextFormatColl; }
- void SetLinkedCharFormat(SwCharFormat& rLink);
+ void SetLinkedCharFormat(SwCharFormat* pLink);
const SwCharFormat* GetLinkedCharFormat() const;