sw/source/uibase/wrtsh/wrtsh1.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+)
New commits: commit e9c187db207f971c9eab9268eefdbceb769f0fdb Author: Jim Raykowski <[email protected]> AuthorDate: Fri Feb 6 01:17:00 2026 -0900 Commit: Jim Raykowski <[email protected]> CommitDate: Sun Feb 8 07:22:31 2026 +0100 tdf#170599 fix outline folding crash When reopening Print Preview with outline folding enabled and a heading in the first paragraph and display formatting hidden characters option is enabled. Effort to understand why this crash happens revealed a similar occurrence in SwDocShell::LoadStyles_. While moving the call to InvalidateOutlineContentVisibility in SwView ctor to before the line having 'g_NoInterrupt = bOld' seems to avoid the crash, or my first approach of conditionally including StartAction/EndAction through use of a function argument, this patch uses the comphelper::FlagRestorationGuard used in rhbz#818557, fdo#58893 fix in SwDocShell::LoadStyles_: "rhbz#818557, fdo#58893: EndAllAction will call SelectShell(), which pushes a bunch of SfxShells that are not cleared (for unknown reasons) when closing the document, causing crash; setting g_bNoInterrupt appears to avoid the problem." Attempts to make this crash occur in a unit test have not been successful; therefore one is not included with this patch. Change-Id: I993f0faef68bcb1ac6a9f38a241de48fa755a475 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198821 Tested-by: Jenkins Reviewed-by: Jim Raykowski <[email protected]> diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 671d5e1e2e6c..6fc130b6c3dc 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -129,6 +129,8 @@ #include <UndoAttribute.hxx> +#include <comphelper/flagguard.hxx> + using namespace sw::mark; using namespace com::sun::star; namespace { @@ -2711,6 +2713,15 @@ void SwWrtShell::MakeOutlineContentVisible(const size_t nPos, bool bMakeVisible, // make content visible or not visible only if needed void SwWrtShell::InvalidateOutlineContentVisibility() { + // tdf#170599 fix taken from fix for: + // "rhbz#818557, fdo#58893: EndAllAction will call SelectShell(), + // which pushes a bunch of SfxShells that are not cleared + // (for unknown reasons) when closing the document, causing crash; + // setting g_bNoInterrupt appears to avoid the problem." + // In this case the crash occurs when reopening Print Preview with outline folding enabled and + // a heading in the first paragraph and display formatting hidden characters option is enabled. + comphelper::FlagRestorationGuard g(g_bNoInterrupt, true); + StartAction(); GetView().GetEditWin().GetFrameControlsManager().HideControls(FrameControlType::Outline);
