sw/inc/calbck.hxx                |    8 ++-----
 sw/source/core/attr/calbck.cxx   |   44 +++++++++++++++------------------------
 sw/source/core/table/swtable.cxx |    2 -
 3 files changed, 22 insertions(+), 32 deletions(-)

New commits:
commit 938cd22ae87d7098143a0e18e1e348479cdf69e9
Author: Bjoern Michaelsen <bjoern.michael...@canonical.com>
Date:   Tue Nov 10 22:50:47 2015 +0100

    remove b_mInDocDTOR flag altogether
    
    Change-Id: I09ca56854f23fe1fc452648042990bee29082f88

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index f718507..dcd6dc9 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -149,7 +149,6 @@ class SW_DLLPUBLIC SwModify: public SwClient
     sw::WriterListener* m_pWriterListeners;                // the start of the 
linked list of clients
     bool m_bModifyLocked : 1;         // don't broadcast changes now
     bool m_bLockClientList : 1;       // may be set when this instance 
notifies its clients
-    bool m_bInDocDTOR : 1;            // workaround for problems when a lot of 
objects are destroyed
     bool m_bInCache   : 1;
     bool m_bInSwFntCache : 1;
 
@@ -162,10 +161,10 @@ class SW_DLLPUBLIC SwModify: public SwClient
     SwModify &operator =(const SwModify&) = delete;
 public:
     SwModify()
-        : SwClient(nullptr), m_pWriterListeners(nullptr), 
m_bModifyLocked(false), m_bLockClientList(false), m_bInDocDTOR(false), 
m_bInCache(false), m_bInSwFntCache(false)
+        : SwClient(nullptr), m_pWriterListeners(nullptr), 
m_bModifyLocked(false), m_bLockClientList(false), m_bInCache(false), 
m_bInSwFntCache(false)
     {}
     explicit SwModify( SwModify* pToRegisterIn )
-        : SwClient(pToRegisterIn), m_pWriterListeners(nullptr), 
m_bModifyLocked(false), m_bLockClientList(false), m_bInDocDTOR(false), 
m_bInCache(false), m_bInSwFntCache(false)
+        : SwClient(pToRegisterIn), m_pWriterListeners(nullptr), 
m_bModifyLocked(false), m_bLockClientList(false), m_bInCache(false), 
m_bInSwFntCache(false)
     {}
 
     // broadcasting: send notifications to all clients
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 51a188c..d7ec7cd 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -77,13 +77,13 @@ void SwClient::Modify(SfxPoolItem const*const pOldValue, 
SfxPoolItem const*const
 
 void SwModify::SetInDocDTOR()
 {
-    m_bInDocDTOR = true;
     // If the document gets destroyed anyway, just tell clients to
     // forget me so that they don't try to get removed from my list
     // later when they also get destroyed
     SwIterator<SwClient,SwModify> aIter(*this);
     for(SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next())
         pClient->pRegisteredIn = nullptr;
+    m_pWriterListeners = nullptr;
 }
 
 SwModify::~SwModify()
@@ -97,8 +97,6 @@ SwModify::~SwModify()
     if ( IsInSwFntCache() )
         pSwFontCache->Delete( this );
 
-    if(m_bInDocDTOR)
-        return;
     // notify all clients that they shall remove themselves
     SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this );
     NotifyClients( &aDyObject, &aDyObject );
@@ -203,9 +201,6 @@ void SwModify::Add( SwClient* pDepend )
 
 SwClient* SwModify::Remove( SwClient* pDepend )
 {
-    if(m_bInDocDTOR)
-        return nullptr;
-
     DBG_TESTSOLARMUTEX();
     assert(pDepend->pRegisteredIn == this);
 
commit f93a2e530d94c4ef73e234b8cc5d3dd79977a8c8
Author: Bjoern Michaelsen <bjoern.michael...@canonical.com>
Date:   Tue Nov 10 22:12:59 2015 +0100

    reduce branch depth in SwModify dtor
    
    Change-Id: I82046cfc191425dc830125944214293b5b9197f9

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index b56575d..f718507 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -192,7 +192,7 @@ public:
     void UnlockModify()                 { m_bModifyLocked = false; }
     void SetInCache( bool bNew )        { m_bInCache = bNew;       }
     void SetInSwFntCache( bool bNew )   { m_bInSwFntCache = bNew;  }
-    void SetInDocDTOR()                 { m_bInDocDTOR = true; }
+    void SetInDocDTOR();
     bool IsModifyLocked() const     { return m_bModifyLocked;  }
     bool IsInCache()      const     { return m_bInCache;       }
     bool IsInSwFntCache() const     { return m_bInSwFntCache;  }
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index fb6654e..51a188c 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -75,6 +75,17 @@ void SwClient::Modify(SfxPoolItem const*const pOldValue, 
SfxPoolItem const*const
     CheckRegistration( pOldValue, pNewValue );
 }
 
+void SwModify::SetInDocDTOR()
+{
+    m_bInDocDTOR = true;
+    // If the document gets destroyed anyway, just tell clients to
+    // forget me so that they don't try to get removed from my list
+    // later when they also get destroyed
+    SwIterator<SwClient,SwModify> aIter(*this);
+    for(SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next())
+        pClient->pRegisteredIn = nullptr;
+}
+
 SwModify::~SwModify()
 {
     DBG_TESTSOLARMUTEX();
@@ -86,30 +97,16 @@ SwModify::~SwModify()
     if ( IsInSwFntCache() )
         pSwFontCache->Delete( this );
 
-    if( m_pWriterListeners )
-    {
-        // there are depending objects
-        if( m_bInDocDTOR )
-        {
-            // If the document gets destroyed anyway, just tell clients to
-            // forget me so that they don't try to get removed from my list
-            // later when they also get destroyed
-            SwIterator<SwClient,SwModify> aIter(*this);
-            for(SwClient* pClient = aIter.First(); pClient; pClient = 
aIter.Next())
-                pClient->pRegisteredIn = nullptr;
-        }
-        else
-        {
-            // notify all clients that they shall remove themselves
-            SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this );
-            NotifyClients( &aDyObject, &aDyObject );
-
-            // remove all clients that have not done themselves
-            // mba: possibly a hotfix for forgotten base class calls?!
-            while( m_pWriterListeners )
-                static_cast<SwClient*>(m_pWriterListeners)->CheckRegistration( 
&aDyObject, &aDyObject );
-        }
-    }
+    if(m_bInDocDTOR)
+        return;
+    // notify all clients that they shall remove themselves
+    SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this );
+    NotifyClients( &aDyObject, &aDyObject );
+
+    // remove all clients that have not done themselves
+    // mba: possibly a hotfix for forgotten base class calls?!
+    while( m_pWriterListeners )
+        static_cast<SwClient*>(m_pWriterListeners)->CheckRegistration( 
&aDyObject, &aDyObject );
 }
 
 void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* 
pNewValue )
commit 0b0d80bd30f918d8c8f3eb6926ced2a562ec912a
Author: Bjoern Michaelsen <bjoern.michael...@canonical.com>
Date:   Tue Nov 10 21:56:47 2015 +0100

    remove IsInDocDTOR() as a public member
    
    Change-Id: Ic4d29d6904d5631dbf2f755886ac9122c303553f

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index ecf400b..b56575d 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -194,7 +194,6 @@ public:
     void SetInSwFntCache( bool bNew )   { m_bInSwFntCache = bNew;  }
     void SetInDocDTOR()                 { m_bInDocDTOR = true; }
     bool IsModifyLocked() const     { return m_bModifyLocked;  }
-    bool IsInDocDTOR()    const     { return m_bInDocDTOR;     }
     bool IsInCache()      const     { return m_bInCache;       }
     bool IsInSwFntCache() const     { return m_bInSwFntCache;  }
 
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 0ba6a74..fb6654e 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -89,7 +89,7 @@ SwModify::~SwModify()
     if( m_pWriterListeners )
     {
         // there are depending objects
-        if( IsInDocDTOR() )
+        if( m_bInDocDTOR )
         {
             // If the document gets destroyed anyway, just tell clients to
             // forget me so that they don't try to get removed from my list
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index f27f315..8cb9d0e 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2171,7 +2171,7 @@ void ChgNumToText( SwTableBox& rBox, sal_uLong nFormat )
 // for detection of modifications (mainly TableBoxAttribute)
 void SwTableBoxFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* 
pNew )
 {
-    if( !IsModifyLocked() && !IsInDocDTOR() )
+    if( !IsModifyLocked() && GetDoc() && !GetDoc()->IsInDtor())
     {
         const SwTableBoxNumFormat *pNewFormat = nullptr;
         const SwTableBoxFormula *pNewFormula = nullptr;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to