summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-05-26 15:08:59 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-05-26 15:21:54 +0200
commit1925a57dee73933ffbdb3b57349b757470a8218a (patch)
tree07d5b1c8a1d67bd36b0143f0ebddb0eca126b629
parent0f98a035806aed03ba56e292bc7ee17b242ff2a0 (diff)
Remove SwClients before destruction in some uno wrapper classes
- SwXTextTableCursor, SwXCellRange, SwXTextPortion, SwNavigationMgr, SwXParaFrameEnumeration - this was overlooked due to confusion over our bazillion different debug modes Change-Id: I0965184b3ffc4854c26838ff78aef06f4544a9b1
-rw-r--r--sw/inc/unotbl.hxx13
-rw-r--r--sw/source/core/unocore/unocrsr.cxx5
-rw-r--r--sw/source/core/unocore/unoobj2.cxx2
-rw-r--r--sw/source/core/unocore/unoport.cxx6
-rw-r--r--sw/source/uibase/inc/navmgr.hxx9
5 files changed, 29 insertions, 6 deletions
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 405d1d4531d9..28fecfbbc8fa 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -42,6 +42,7 @@
#include <unotext.hxx>
#include <frmfmt.hxx>
#include <tuple>
+#include <unocrsr.hxx>
class SwUnoCrsr;
class SwTable;
@@ -217,7 +218,6 @@ public:
SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox* pBox);
SwXTextTableCursor(SwFrameFormat& rTableFormat,
const SwTableCursor* pTableSelection);
-
DECLARE_XINTERFACE()
//XTextTableCursor
@@ -276,6 +276,12 @@ public:
SwUnoCrsr* GetCrsr();
std::shared_ptr<SwUnoCrsr> m_pUnoCrsr;
SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
+ ~SwXTextTableCursor()
+ {
+ if(m_pUnoCrsr)
+ m_pUnoCrsr->Remove(&aCrsrDepend);
+ }
+
};
struct SwRangeDescriptor
@@ -469,6 +475,11 @@ public:
SwXCellRange(std::shared_ptr<SwUnoCrsr> pCrsr, SwFrameFormat& rFrameFormat, SwRangeDescriptor& rDesc);
void SetLabels(bool bFirstRowAsLabel, bool bFirstColumnAsLabel)
{ m_bFirstRowAsLabel = bFirstRowAsLabel, m_bFirstColumnAsLabel = bFirstColumnAsLabel; }
+ virtual ~SwXCellRange()
+ {
+ if(m_pTableCrsr)
+ m_pTableCrsr->Remove(&aCursorDepend);
+ }
std::vector< css::uno::Reference< css::table::XCell > > getCells();
TYPEINFO_OVERRIDE();
diff --git a/sw/source/core/unocore/unocrsr.cxx b/sw/source/core/unocore/unocrsr.cxx
index 265ac4f5daf5..bca0bb79f859 100644
--- a/sw/source/core/unocore/unocrsr.cxx
+++ b/sw/source/core/unocore/unocrsr.cxx
@@ -40,10 +40,7 @@ SwUnoCrsr::~SwUnoCrsr()
SwDoc* pDoc = GetDoc();
if( !pDoc->IsInDtor() )
{
-#ifdef DBG_UTIL_TODO
- SwIterator<SwClient, SwUnoCrsr> pClient(*this);
- assert(!pClient.First());
-#endif
+ assert(!static_cast<bool>(SwIterator<SwClient, SwUnoCrsr>(*this).First()));
// 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; });
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 468ffc6580e2..417241597972 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1712,6 +1712,8 @@ public:
}
virtual ~Impl() {
+ if(m_pUnoCursor)
+ m_pUnoCursor->Remove(this);
// Impl owns the cursor; delete it here: SolarMutex is locked
}
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 3ffb5cddaeb6..ad81d7ecefd2 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -137,7 +137,11 @@ SwXTextPortion::SwXTextPortion(
}
}
-SwXTextPortion::~SwXTextPortion() {};
+SwXTextPortion::~SwXTextPortion()
+{
+ if(m_pUnoCursor)
+ m_pUnoCursor->Remove(this);
+};
uno::Reference< text::XText > SwXTextPortion::getText()
throw( uno::RuntimeException, std::exception )
diff --git a/sw/source/uibase/inc/navmgr.hxx b/sw/source/uibase/inc/navmgr.hxx
index ce3128e672b0..6eabe4c23c20 100644
--- a/sw/source/uibase/inc/navmgr.hxx
+++ b/sw/source/uibase/inc/navmgr.hxx
@@ -14,6 +14,7 @@
#include "swtypes.hxx"
#include "calbck.hxx"
+#include "unocrsr.hxx"
class SwWrtShell;
struct SwPosition;
@@ -41,6 +42,14 @@ private:
public:
/* Constructor that initializes the shell to the current shell */
SwNavigationMgr( SwWrtShell & rShell );
+ ~SwNavigationMgr()
+ {
+ for(auto pEntry : m_entries)
+ {
+ if(pEntry && GetRegisteredIn() == pEntry.get())
+ pEntry->Remove(this);
+ }
+ }
/* Can we go back in the history ? */
bool backEnabled() ;
/* Can we go forward in the history ? */