summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-12-04 11:52:53 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-12-04 11:07:34 +0000
commit9e2973dbb90b5d9ce004cbf333f5000e4d50dc18 (patch)
tree039d1dba4fcd8fd0db8eb8e94be113201da128e6 /sw
parentb1ff7054a0d7c12e0961c7a78bb2626b33c7f0d1 (diff)
fix SwClient crash in SwXNumberingRules/SwXTableRows/SwXTableColumns
was generated a crash when running 'make check' on my Linux box. These classes need to hold the SolarMutex when destructing their SwClient base class. Change-Id: I448ea00978d003aa37d8663d37b4edf9e54a6a56 Reviewed-on: https://gerrit.libreoffice.org/20391 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/unosett.hxx13
-rw-r--r--sw/inc/unotbl.hxx24
-rw-r--r--sw/source/core/unocore/unosett.cxx34
-rw-r--r--sw/source/core/unocore/unotbl.cxx36
4 files changed, 74 insertions, 33 deletions
diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx
index d19f5f170885..7e10aca52564 100644
--- a/sw/inc/unosett.hxx
+++ b/sw/inc/unosett.hxx
@@ -32,6 +32,7 @@
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implbase5.hxx>
#include <svl/itemprop.hxx>
+#include <unobaseclass.hxx>
class SwDoc;
class SwFormatCol;
@@ -136,9 +137,12 @@ class SwXNumberingRules : public cppu::WeakAggImplHelper5
css::beans::XPropertySet,
css::container::XNamed,
css::lang::XServiceInfo
->,
- public SwClient
+>
{
+private:
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
OUString m_sNewCharStyleNames[MAXLEVEL];
OUString m_sNewBulletFontNames[MAXLEVEL];
OUString m_sCreatedNumRuleName; //connects to a numbering in SwDoc
@@ -146,13 +150,10 @@ class SwXNumberingRules : public cppu::WeakAggImplHelper5
SwDocShell* pDocShell; // Only if used as chapter numbering.
SwNumRule* pNumRule;
const SfxItemPropertySet* m_pPropertySet;
- bool bOwnNumRuleCreated;
+ bool bOwnNumRuleCreated;
protected:
virtual ~SwXNumberingRules();
- //SwClient
- virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
-
public:
SwXNumberingRules(SwDocShell& rDocSh); // chapter numbering
SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc = nullptr); // NumRule for paragraphs, numbering styles
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 96323c274809..5de9902516be 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -547,11 +547,12 @@ class SwXTableRows final : public cppu::WeakImplHelper
<
css::table::XTableRows,
css::lang::XServiceInfo
->,
- public SwClient
-
+>
{
- SwFrameFormat* GetFrameFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); }
+private:
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+ SwFrameFormat* GetFrameFormat();
const SwFrameFormat* GetFrameFormat() const { return const_cast<SwXTableRows*>(this)->GetFrameFormat(); }
protected:
virtual ~SwXTableRows();
@@ -579,20 +580,18 @@ public:
virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) override;
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception ) override;
-
- //SwClient
- virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
};
class SwXTableColumns : public cppu::WeakImplHelper
<
css::table::XTableColumns,
css::lang::XServiceInfo
->,
- public SwClient
-
+>
{
- SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
+private:
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+ SwFrameFormat* GetFrameFormat() const;
protected:
virtual ~SwXTableColumns();
public:
@@ -619,9 +618,6 @@ public:
virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) override;
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( css::uno::RuntimeException, std::exception ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception ) override;
-
- //SwClient
- virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
};
int sw_CompareCellRanges(
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index e34c0d259635..b3a55713c4e4 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1048,7 +1048,20 @@ void SwXLineNumberingProperties::removeVetoableChangeListener(const OUString& /*
OSL_FAIL("not implemented");
}
-const char aInvalidStyle[] = "__XXX___invalid";
+static const char aInvalidStyle[] = "__XXX___invalid";
+
+
+class SwXNumberingRules::Impl : public SwClient
+{
+private:
+ SwXNumberingRules& m_rParent;
+public:
+ Impl(SwXNumberingRules& rParent) : m_rParent(rParent) {}
+protected:
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
+};
+
bool SwXNumberingRules::isInvalidStyle(const OUString &rName)
{
@@ -1094,6 +1107,7 @@ Sequence< OUString > SwXNumberingRules::getSupportedServiceNames() throw( Runtim
}
SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc) :
+ m_pImpl(new SwXNumberingRules::Impl(*this)),
pDoc(doc),
pDocShell(nullptr),
pNumRule(new SwNumRule(rRule)),
@@ -1113,7 +1127,7 @@ SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc) :
}
}
if(pDoc)
- pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(&*m_pImpl);
for(sal_uInt16 i = 0; i < MAXLEVEL; ++i)
{
m_sNewCharStyleNames[i] = aInvalidStyle;
@@ -1122,23 +1136,25 @@ SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc) :
}
SwXNumberingRules::SwXNumberingRules(SwDocShell& rDocSh) :
+ m_pImpl(new SwXNumberingRules::Impl(*this)),
pDoc(nullptr),
pDocShell(&rDocSh),
pNumRule(nullptr),
m_pPropertySet(GetNumberingRulesSet()),
bOwnNumRuleCreated(false)
{
- pDocShell->GetDoc()->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ pDocShell->GetDoc()->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(&*m_pImpl);
}
SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) :
+ m_pImpl(new SwXNumberingRules::Impl(*this)),
pDoc(&rDoc),
pDocShell(nullptr),
pNumRule(nullptr),
m_pPropertySet(GetNumberingRulesSet()),
bOwnNumRuleCreated(false)
{
- rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(&*m_pImpl);
m_sCreatedNumRuleName = rDoc.GetUniqueNumRuleName();
#if OSL_DEBUG_LEVEL > 1
const sal_uInt16 nIndex =
@@ -2249,15 +2265,15 @@ void SwXNumberingRules::setName(const OUString& /*rName*/) throw( RuntimeExcepti
throw aExcept;
}
-void SwXNumberingRules::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
+void SwXNumberingRules::Impl::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
{
ClientModify(this, pOld, pNew);
if(!GetRegisteredIn())
{
- if(bOwnNumRuleCreated)
- delete pNumRule;
- pNumRule = nullptr;
- pDoc = nullptr;
+ if(m_rParent.bOwnNumRuleCreated)
+ delete m_rParent.pNumRule;
+ m_rParent.pNumRule = nullptr;
+ m_rParent.pDoc = nullptr;
}
}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 3d8c53dadba4..d8cf5c6ac459 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -3756,6 +3756,15 @@ void SwXCellRange::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
}
}
+class SwXTableRows::Impl : public SwClient
+{
+public:
+ Impl(SwFrameFormat& rFrameFormat) : SwClient(&rFrameFormat) {}
+protected:
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
+};
+
// SwXTableRows
OUString SwXTableRows::getImplementationName() throw( uno::RuntimeException, std::exception )
@@ -3769,12 +3778,17 @@ uno::Sequence< OUString > SwXTableRows::getSupportedServiceNames() throw( uno::R
SwXTableRows::SwXTableRows(SwFrameFormat& rFrameFormat) :
- SwClient(&rFrameFormat)
+ m_pImpl(new SwXTableRows::Impl(rFrameFormat))
{ }
SwXTableRows::~SwXTableRows()
{ }
+SwFrameFormat* SwXTableRows::GetFrameFormat()
+{
+ return static_cast<SwFrameFormat*>(m_pImpl->GetRegisteredIn());
+}
+
sal_Int32 SwXTableRows::getCount() throw( uno::RuntimeException, std::exception )
{
SolarMutexGuard aGuard;
@@ -3904,11 +3918,20 @@ void SwXTableRows::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount)
}
}
-void SwXTableRows::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
+void SwXTableRows::Impl::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
{ ClientModify(this, pOld, pNew); }
// SwXTableColumns
+class SwXTableColumns::Impl : public SwClient
+{
+public:
+ Impl(SwFrameFormat& rFrameFormat) : SwClient(&rFrameFormat) {}
+protected:
+ //SwClient
+ virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
+};
+
OUString SwXTableColumns::getImplementationName() throw( uno::RuntimeException, std::exception )
{ return OUString("SwXTableColumns"); }
@@ -3920,12 +3943,17 @@ uno::Sequence< OUString > SwXTableColumns::getSupportedServiceNames() throw( uno
SwXTableColumns::SwXTableColumns(SwFrameFormat& rFrameFormat) :
- SwClient(&rFrameFormat)
+ m_pImpl(new SwXTableColumns::Impl(rFrameFormat))
{ }
SwXTableColumns::~SwXTableColumns()
{ }
+SwFrameFormat* SwXTableColumns::GetFrameFormat() const
+{
+ return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(m_pImpl->GetRegisteredIn()));
+}
+
sal_Int32 SwXTableColumns::getCount() throw( uno::RuntimeException, std::exception )
{
SolarMutexGuard aGuard;
@@ -4044,7 +4072,7 @@ void SwXTableColumns::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount)
}
}
-void SwXTableColumns::Modify(const SfxPoolItem* pOld, const SfxPoolItem *pNew)
+void SwXTableColumns::Impl::Modify(const SfxPoolItem* pOld, const SfxPoolItem *pNew)
{ ClientModify(this, pOld, pNew); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */