sw/source/uibase/shells/textsh1.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 6f4adc1274cfac30b9097411bb193bd4386969f0
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Fri May 31 16:23:59 2024 -0400
Commit:     Patrick Luby <guibomac...@gmail.com>
CommitDate: Tue Jun 11 23:18:56 2024 +0200

    tdf#160801 fix crash by delaying resetting of attributes
    
    Calling SwWrtShell::ResetAttr() will sometimes delete the
    current SwTextShell instance so call it after clearing the
    direct formatting flag.
    
    Change-Id: I43a66527cee30271447dff30f166086c6759e162
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168304
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index a51c7f6432be..0144b01dbfaf 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1049,12 +1049,17 @@ void SwTextShell::Execute(SfxRequest &rReq)
                 for (sal_uInt16 i = nBegin; i <= nEnd; ++i)
                     aAttribs.insert( i );
             }
-            rWrtSh.ResetAttr( aAttribs );
 
             // also clear the direct formatting flag inside SwTableBox(es)
             if (SwFEShell* pFEShell = GetView().GetDocShell()->GetFEShell())
                 pFEShell->UpdateTableStyleFormatting(nullptr, true);
 
+            // tdf#160801 fix crash by delaying resetting of attributes
+            // Calling SwWrtShell::ResetAttr() will sometimes delete the
+            // current SwTextShell instance so call it after clearing the
+            // direct formatting flag.
+            rWrtSh.ResetAttr( aAttribs );
+
             rReq.Done();
             break;
         }

Reply via email to