diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-05-23 13:25:12 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-05-26 00:51:14 +0200 |
commit | 692c886f937c525d6bfcb541917a5114b085efa9 (patch) | |
tree | 9aa1bbe7871f5d1216839048a122b2373c418cd0 | |
parent | 1ef03cad1ac3d593b4ac361ef582b3fd4fc96677 (diff) |
remove the weak_ptrs on destruction too
Change-Id: I65f5867c41417539a70eef15754988d9931394a4
-rw-r--r-- | sw/source/core/unocore/unocrsr.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sw/source/core/unocore/unocrsr.cxx b/sw/source/core/unocore/unocrsr.cxx index 3d3c1d1a564b..88c627e8491a 100644 --- a/sw/source/core/unocore/unocrsr.cxx +++ b/sw/source/core/unocore/unocrsr.cxx @@ -23,6 +23,7 @@ #include <swtable.hxx> #include <docary.hxx> #include <rootfrm.hxx> +#include <calbck.hxx> IMPL_FIXEDMEMPOOL_NEWDEL( SwUnoCrsr ) @@ -39,7 +40,13 @@ SwUnoCrsr::~SwUnoCrsr() SwDoc* pDoc = GetDoc(); if( !pDoc->IsInDtor() ) { - //assert(!SwIterator<SwClient,SwUnoCrsr>(this).First()); +#ifdef DBG_UTIL + SwIterator<SwClient, SwUnoCrsr> pClient(*this); + assert(!pClient.First()); +#endif + // remove the weak_ptr the document keeps to notify about document death + pDoc->mvUnoCrsrTbl.remove_if( + [this](const std::weak_ptr<SwUnoCrsr>& pWeakPtr) -> bool { return pWeakPtr.lock().get() == this; }); } // delete the whole ring |