diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-05-09 20:22:13 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-05-26 00:51:07 +0200 |
commit | 6acd1be82296b8c1118b3ec0e3fd99b88783662a (patch) | |
tree | 65f439a83dd0386357043965eb80a78e0e3a09b6 /sw | |
parent | 4be419852b0fde877b707e2b6cf7442517d38d46 (diff) |
some more asserts
Change-Id: I94a6d0303989e499026be151cc71777b8e944dd2
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unocrsr.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/attr/calbck.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/attr/format.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unocrsr.cxx | 18 |
5 files changed, 18 insertions, 4 deletions
diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx index 83f04abd06f0..767c534ae13d 100644 --- a/sw/inc/unocrsr.hxx +++ b/sw/inc/unocrsr.hxx @@ -40,6 +40,7 @@ private: public: SwUnoCrsr( const SwPosition &rPos, SwPaM* pRing = 0 ); virtual ~SwUnoCrsr(); + bool m_bSaneOwnership; protected: diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index d958bd64a4db..3d64f3a15778 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -153,6 +153,7 @@ void SwModify::Add( SwClient* pDepend ) for(auto& rIter : sw::ClientIteratorBase::our_pClientIters->GetRingContainer()) { OSL_ENSURE( &rIter.m_rRoot != m_pWriterListeners, "Client added to active ClientIter" ); + //assert(&rIter.m_rRoot != m_pWriterListeners); } } #endif diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index f5df08fa9860..934045bba438 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -243,6 +243,7 @@ SwFormat::~SwFormat() SwIterator<SwClient,SwFormat> aIter(*this); for(SwClient* pClient = aIter.First(); pClient && pParentFormat; pClient = aIter.Next()) { + SAL_INFO("sw.core", "reparenting " << typeid(*pClient).name() << " at " << pClient << " from " << typeid(*this).name() << " at " << this << " to " << typeid(*pParentFormat).name() << " at " << pParentFormat); pParentFormat->Add( pClient ); pClient->ModifyNotification( &aOldFormat, &aNewFormat ); } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 18e910f509de..454ea0aab2b5 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1698,6 +1698,7 @@ std::shared_ptr<SwUnoCrsr> SwDoc::CreateUnoCrsr2( const SwPosition& rPos, bool b else pNew.reset(new SwUnoCrsr( rPos )); + pNew->m_bSaneOwnership = true; mvUnoCrsrTbl2.push_back( pNew ); return pNew; } diff --git a/sw/source/core/unocore/unocrsr.cxx b/sw/source/core/unocore/unocrsr.cxx index 1edb7826dcca..3ee3444016df 100644 --- a/sw/source/core/unocore/unocrsr.cxx +++ b/sw/source/core/unocore/unocrsr.cxx @@ -32,6 +32,7 @@ SwUnoCrsr::SwUnoCrsr( const SwPosition &rPos, SwPaM* pRing ) , m_bRemainInSection(true) , m_bSkipOverHiddenSections(false) , m_bSkipOverProtectSections(false) + , m_bSaneOwnership(false) {} SwUnoCrsr::~SwUnoCrsr() @@ -39,11 +40,18 @@ SwUnoCrsr::~SwUnoCrsr() SwDoc* pDoc = GetDoc(); if( !pDoc->IsInDtor() ) { - // then remove cursor from array - SwUnoCrsrTable& rTable = (SwUnoCrsrTable&)pDoc->GetUnoCrsrTable(); - if( !rTable.erase( this ) ) + if(m_bSaneOwnership) { - OSL_ENSURE( false, "UNO Cursor nicht mehr im Array" ); + //assert(!SwIterator<SwClient,SwUnoCrsr>(this).First()); + } + else + { + // then remove cursor from array + SwUnoCrsrTable& rTable = (SwUnoCrsrTable&)pDoc->GetUnoCrsrTable(); + if( !rTable.erase( this ) ) + { + OSL_ENSURE( false, "UNO Cursor nicht mehr im Array" ); + } } } @@ -58,6 +66,7 @@ SwUnoCrsr::~SwUnoCrsr() SwUnoCrsr * SwUnoCrsr::Clone() const { + assert(!m_bSaneOwnership); SwUnoCrsr * pNewCrsr = GetDoc()->CreateUnoCrsr( *GetPoint() ); if (HasMark()) { @@ -69,6 +78,7 @@ SwUnoCrsr * SwUnoCrsr::Clone() const SwUnoTableCrsr * SwUnoTableCrsr::Clone() const { + assert(!m_bSaneOwnership); SwUnoTableCrsr * pNewCrsr = dynamic_cast<SwUnoTableCrsr*>( GetDoc()->CreateUnoCrsr( *GetPoint(), true /* create SwUnoTableCrsr */ ) ); |