summaryrefslogtreecommitdiff
path: root/sw/source/uibase/wrtsh
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-05-06 01:33:30 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-05-26 00:51:05 +0200
commitada20978a4e5c26dfe6c4227d310a133e50d9b2e (patch)
tree04dd0adc2a7ee55dcd2711e09f5b9c0087d387b5 /sw/source/uibase/wrtsh
parent20c235df449f341774441f3bc5f567b839b75536 (diff)
make SwNavigationMgr use the shared_ptr
- also make it listen to at least one of the SwUnoCrsr it keeps on the heap for document disposing. - as the SwNavigationMgr lives longer than the document this was actually a double free before: first from SwUnoCrsrTbl dtor an then from the shared_ptr in SwNavigationMgr Change-Id: Ia75ad81a978ca37ed2a94fd221427b62e99e1bb3
Diffstat (limited to 'sw/source/uibase/wrtsh')
-rw-r--r--sw/source/uibase/wrtsh/navmgr.cxx21
1 files changed, 17 insertions, 4 deletions
diff --git a/sw/source/uibase/wrtsh/navmgr.cxx b/sw/source/uibase/wrtsh/navmgr.cxx
index 740e8b71e516..d843e3755679 100644
--- a/sw/source/uibase/wrtsh/navmgr.cxx
+++ b/sw/source/uibase/wrtsh/navmgr.cxx
@@ -162,15 +162,17 @@ bool SwNavigationMgr::addEntry(const SwPosition& rPos) {
if (*m_entries.back()->GetPoint() != rPos)
{
- SwUnoCrsr *const pCursor = m_rMyShell.GetDoc()->CreateUnoCrsr(rPos);
- m_entries.push_back(::boost::shared_ptr<SwUnoCrsr>(pCursor));
+ std::shared_ptr<SwUnoCrsr> pCursor(m_rMyShell.GetDoc()->CreateUnoCrsr2(rPos));
+ m_entries.push_back(pCursor);
+ pCursor->Add(this);
}
bRet = true;
}
else {
if ( (!m_entries.empty() && *m_entries.back()->GetPoint() != rPos) || m_entries.empty() ) {
- SwUnoCrsr *const pCursor = m_rMyShell.GetDoc()->CreateUnoCrsr(rPos);
- m_entries.push_back(::boost::shared_ptr<SwUnoCrsr>(pCursor));
+ auto pCursor(m_rMyShell.GetDoc()->CreateUnoCrsr2(rPos));
+ m_entries.push_back(pCursor);
+ pCursor->Add(this);
bRet = true;
}
if (m_entries.size() > 1 && *m_entries.back()->GetPoint() == rPos)
@@ -213,4 +215,15 @@ bool SwNavigationMgr::addEntry(const SwPosition& rPos) {
return bRet;
}
+
+void SwNavigationMgr::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
+{
+ if(typeid(rHint) == typeid(sw::DocDisposingHint))
+ {
+ m_entries.clear();
+ }
+ else
+ SwClient::SwClientNotify(rModify, rHint);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */