summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-01-02 00:53:13 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-01-02 00:53:13 +0100
commit952f41ed0806cd8bfbd568a7c87df7f6368fdca9 (patch)
tree6ca9503fa0a8e44f6d0f865496e138c4c826c78c /sw
parentbcf90db8c57fc48d20ee2d2cdec8666c214fe525 (diff)
trying to chip away some of the memory mgmt madness here
- mpItemSet is assumed to be owned by SwStyleBase_Impl - yet it can be external set to any naked pointer - ... and is (temporary, at least that is the hope) set to ItemSets owned by others Change-Id: I0cd56f5bb9f58a2e5ab09f49f66faf8a63c69f37
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unostyle.cxx17
1 files changed, 6 insertions, 11 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 88a7df4cdb14..42a8f110946b 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1317,6 +1317,7 @@ private:
const SwPageDesc* m_pOldPageDesc;
rtl::Reference<SwDocStyleSheet> m_xNewBase;
SfxItemSet* m_pItemSet;
+ std::unique_ptr<SfxItemSet> m_pMyItemSet;
OUString m_rStyleName;
const SwAttrSet* m_pParentStyle;
@@ -1325,15 +1326,10 @@ public:
: m_rDoc(rSwDoc)
, m_pOldPageDesc(nullptr)
, m_pItemSet(nullptr)
+ , m_pMyItemSet(nullptr)
, m_rStyleName(rName)
, m_pParentStyle(pParentStyle)
- {
- }
-
- ~SwStyleBase_Impl()
- {
- delete m_pItemSet;
- }
+ { }
rtl::Reference<SwDocStyleSheet>& getNewBase()
{
@@ -1359,16 +1355,15 @@ public:
SfxItemSet& GetItemSet()
{
- OSL_ENSURE(m_xNewBase.is(), "no SwDocStyleSheet available");
+ assert(m_xNewBase.is());
if(!m_pItemSet)
{
- m_pItemSet = new SfxItemSet(m_xNewBase->GetItemSet());
+ m_pMyItemSet.reset(new SfxItemSet(m_xNewBase->GetItemSet()));
+ m_pItemSet = m_pMyItemSet.get();
//UUUU set parent style to have the correct XFillStyle setting as XFILL_NONE
if(!m_pItemSet->GetParent() && m_pParentStyle)
- {
m_pItemSet->SetParent(m_pParentStyle);
- }
}
return *m_pItemSet;
}