include/sfx2/frame.hxx          |    2 +-
 sw/source/uibase/app/apphdl.cxx |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2a813483cdbfb458ce62e8d9bdcf2506c0ed02a9
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu May 19 12:03:24 2022 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu May 19 17:45:22 2022 +0200

    sw: fix assert in SwModule::Notify()
    
    Apparently it happens when loading a 0-byte file that the
    SfxObjectShell is still in IsLoading() stage when close() is called.
    
    This then causes the SfxEventHintId::LoadFinished event to be emitted
    during close(), which is not a situation the assert was intended for.
    
    Change-Id: I60a260ca1c1e6cbf9502832ba6622de2628763e7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134610
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
index d8a0b9d90501..86b5baaa756c 100644
--- a/include/sfx2/frame.hxx
+++ b/include/sfx2/frame.hxx
@@ -116,7 +116,7 @@ public:
     SAL_DLLPRIVATE bool PrepareClose_Impl( bool bUI );
     SAL_DLLPRIVATE bool DocIsModified_Impl();
     SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* );
-    SAL_DLLPRIVATE bool IsClosing_Impl() const;
+    bool IsClosing_Impl() const;
     SAL_DLLPRIVATE void SetIsClosing_Impl();
 
     // Methods for accessing the current set
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 958b326f6400..22ccceac4271 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -879,7 +879,7 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const 
SfxHint& rHint )
                     {
                         // assume that not calling via 
SwEditShell::SetFixFields
                         // is allowed, because the shell hasn't been created 
yet
-                        assert(!pWrtSh);
+                        assert(!pWrtSh || 
pWrtSh->GetView().GetViewFrame()->GetFrame().IsClosing_Impl());
                         
pDocSh->GetDoc()->getIDocumentFieldsAccess().SetFixFields(nullptr);
                     }
                 }

Reply via email to