sw/inc/SwNodeNum.hxx                         |    2 +-
 sw/inc/SwNumberTree.hxx                      |    2 +-
 sw/source/core/SwNumberTree/SwNodeNum.cxx    |   20 ++++++++++++--------
 sw/source/core/SwNumberTree/SwNumberTree.cxx |    2 +-
 sw/source/core/txtnode/ndtxt.cxx             |    2 +-
 5 files changed, 16 insertions(+), 12 deletions(-)

New commits:
commit 0dc7b1cbb995d5befea9ee44280b4e725f260796
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Jul 4 20:02:01 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Jul 4 21:47:07 2021 +0200

    ofz#35787 Timeout
    
    1m14.061s -> 0m3.975s
    
    Change-Id: I96e6f2c60017ba57062bd56c2e80604e117b3b99
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118381
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/inc/SwNodeNum.hxx b/sw/inc/SwNodeNum.hxx
index 7ad85271c9fa..2aff25d306ba 100644
--- a/sw/inc/SwNodeNum.hxx
+++ b/sw/inc/SwNodeNum.hxx
@@ -39,7 +39,7 @@ public:
     void ChangeNumRule(SwNumRule& rNumRule);
     SwTextNode* GetTextNode() const { return mpTextNode; }
 
-    virtual bool IsNotificationEnabled() const override;
+    virtual bool IsNotificationEnabled(const SwDoc& rDoc) const override;
 
     virtual bool IsContinuous() const override;
 
diff --git a/sw/inc/SwNumberTree.hxx b/sw/inc/SwNumberTree.hxx
index 39575e8aa46d..f9e3a2745bb9 100644
--- a/sw/inc/SwNumberTree.hxx
+++ b/sw/inc/SwNumberTree.hxx
@@ -354,7 +354,7 @@ protected:
        @retval true   Notification enabled in general.
        @retval false  else
      */
-    virtual bool IsNotificationEnabled() const = 0;
+    virtual bool IsNotificationEnabled(const SwDoc& rDoc) const = 0;
 
     // #i64010# - made pure virtual
     virtual bool HasCountedChildren() const = 0;
diff --git a/sw/source/core/SwNumberTree/SwNodeNum.cxx 
b/sw/source/core/SwNumberTree/SwNodeNum.cxx
index c83b29f086b7..9c160d3c0fc2 100644
--- a/sw/source/core/SwNumberTree/SwNodeNum.cxx
+++ b/sw/source/core/SwNumberTree/SwNodeNum.cxx
@@ -122,22 +122,26 @@ void SwNodeNum::PostRemove()
     }
 }
 
-bool SwNodeNum::IsNotifiable(const SwDoc& /*rDoc*/) const
+bool SwNodeNum::IsNotifiable(const SwDoc& rDoc) const
 {
-    bool aResult = true;
+    bool aResult;
 
-    if ( GetTextNode() )
-        aResult = GetTextNode()->IsNotifiable();
+    if (const SwTextNode* pTextNode = GetTextNode())
+        aResult = pTextNode->IsNotifiable();
+    else
+        aResult = IsNotificationEnabled(rDoc);
 
     return aResult;
 }
 
-bool SwNodeNum::IsNotificationEnabled() const
+bool SwNodeNum::IsNotificationEnabled(const SwDoc& rDoc) const
 {
-    bool aResult = true;
+    bool aResult;
 
-    if ( GetTextNode() )
-        aResult = GetTextNode()->IsNotificationEnabled();
+    if (const SwTextNode* pTextNode = GetTextNode())
+        aResult = pTextNode->IsNotificationEnabled();
+    else
+        aResult = !rDoc.IsInReading() && !rDoc.IsInDtor();
 
     return aResult;
 }
diff --git a/sw/source/core/SwNumberTree/SwNumberTree.cxx 
b/sw/source/core/SwNumberTree/SwNumberTree.cxx
index e695df5622be..bc24899b235b 100644
--- a/sw/source/core/SwNumberTree/SwNumberTree.cxx
+++ b/sw/source/core/SwNumberTree/SwNumberTree.cxx
@@ -487,7 +487,7 @@ void SwNumberTreeNode::AddChild(SwNumberTreeNode* pChild,
         if (aResult.second)
         {
             pChild->mpParent = this;
-            bool bNotification = pChild->IsNotificationEnabled();
+            bool bNotification = pChild->IsNotificationEnabled(rDoc);
             tSwNumberTreeChildren::iterator aInsertedIt = aResult.first;
 
             if (aInsertedIt != mChildren.begin())
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index e75a8f42b682..3d7e081f1e4c 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -4204,7 +4204,7 @@ bool SwTextNode::IsNotifiable() const
 bool SwTextNode::IsNotificationEnabled() const
 {
     const SwDoc& rDoc = GetDoc();
-    return  !(rDoc.IsInReading() || rDoc.IsInDtor());
+    return !rDoc.IsInReading() && !rDoc.IsInDtor();
 }
 
 void SwTextNode::SetCountedInList( bool bCounted )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to