sw/source/core/text/EnhancedPDFExportHelper.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
New commits: commit d2e85fd841e7a043bfd0f8450e5d57f2ef6c4dc6 Author: Michael Stahl <michael.st...@collabora.com> AuthorDate: Wed Sep 10 20:38:40 2025 +0200 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Mon Sep 15 15:04:41 2025 +0200 sw: PDF export: fix crash on section in table in section soffice.bin: vcl/source/gdi/pdfextoutdevdata.cxx:798: void vcl::PDFExtOutDevData::EndStructureElement(): Assertion `mpGlobalSyncData->mCurrentStructElement != 0' failed. The problem is that the parent-opening code in SwTaggedPDFHelper::BeginBlockStructureElements() when called for a section in a table cell opens a section that is outside the table. In this case, there are actually 2 section frames, one containing the table and one in the table cell, so reopening the outer section frame that is already on the stack ends up restoring a 0 parent SE and that triggers the assert. (regression from commit d5f68529a79c615f989fcfeef248d887a6e10f5a) Change-Id: Idd5be655345f96e1c2de84c5623f6e1dba4aae1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190781 Reviewed-by: Michael Stahl <michael.st...@collabora.com> Tested-by: Jenkins (cherry picked from commit 7a036a64581a96a05e4833611801ac304d75524f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190818 Reviewed-by: Thorsten Behrens <thorsten.behr...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 61bcfb6dac55..214e1c17925e 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1374,10 +1374,13 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // open all parent sections, so that the SEs of sections // are nested in the same way as their SwSectionNodes std::vector<SwSection const*> parents; - for (SwSection const* pParent = pSection->GetParent(); - pParent != nullptr; pParent = pParent->GetParent()) + // iterate only *direct* parents - do not leave table cell! + for (SwSectionNode const* pSectionNode{pSection->GetFormat() + ->GetSectionNode()->StartOfSectionNode()->GetSectionNode()}; + pSectionNode != nullptr; + pSectionNode = pSectionNode->StartOfSectionNode()->GetSectionNode()) { - parents.push_back(pParent); + parents.push_back(&pSectionNode->GetSection()); } for (auto it = parents.rbegin(); it != parents.rend(); ++it) {