[Libreoffice-commits] core.git: sw/inc sw/source
Bjoern Michaelsen
bjoern.michaelsen at canonical.com
Tue May 26 06:22:56 PDT 2015
sw/inc/unotbl.hxx | 13 ++++++++++++-
sw/source/core/unocore/unocrsr.cxx | 5 +----
sw/source/core/unocore/unoobj2.cxx | 2 ++
sw/source/core/unocore/unoport.cxx | 6 +++++-
sw/source/uibase/inc/navmgr.hxx | 9 +++++++++
5 files changed, 29 insertions(+), 6 deletions(-)
New commits:
commit 1925a57dee73933ffbdb3b57349b757470a8218a
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Tue May 26 15:08:59 2015 +0200
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
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 405d1d4..28fecfb 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 265ac4f..bca0bb7 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 468ffc6..4172415 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 3ffb5cd..ad81d7e 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 ce3128e..6eabe4c 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 ? */
More information about the Libreoffice-commits
mailing list