diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-01-07 14:21:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-01-07 21:01:17 +0100 |
commit | a6415004630c28ac4c0a64b83d8f0fd5c77a6a31 (patch) | |
tree | 1f756e26269679ab6911450d611cd5b8c84b771d /lotuswordpro | |
parent | 5dda4fb74a7f961d067d4a5b8760d96466ebd0be (diff) |
ofz#43388 Direct-leak
Change-Id: I5d410461d7b4e8466533fc4186ee77ec99fae089
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128123
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/inc/xfilter/xfdrawstyle.hxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lotuswordpro/inc/xfilter/xfdrawstyle.hxx b/lotuswordpro/inc/xfilter/xfdrawstyle.hxx index a426dc99e1d8..b732fbf9c439 100644 --- a/lotuswordpro/inc/xfilter/xfdrawstyle.hxx +++ b/lotuswordpro/inc/xfilter/xfdrawstyle.hxx @@ -131,6 +131,8 @@ private: double m_fArrowEndSize; bool m_bArrowStartCenter; bool m_bArrowEndCenter; + bool m_bLineStyleRegistered; + bool m_bAreaStyleRegistered; }; inline void XFDrawStyle::SetArrowStart(const OUString& start, double size) diff --git a/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx b/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx index 62abd3afbc11..f824dd5a8793 100644 --- a/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx +++ b/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx @@ -71,11 +71,18 @@ XFDrawStyle::XFDrawStyle() , m_fArrowEndSize(0.3) , m_bArrowStartCenter(false) , m_bArrowEndCenter(false) + , m_bLineStyleRegistered(false) + , m_bAreaStyleRegistered(false) {} XFDrawStyle::~XFDrawStyle() { - //don't delete m_pLineStyle, it was managed by XFStyleManager. + // normally don't delete m_pLineStyle, it was managed by XFStyleManager. + if (!m_bLineStyleRegistered) + delete m_pLineStyle; + // normally don't delete m_pAreaStyle, it was managed by XFStyleManager. + if (!m_bAreaStyleRegistered) + delete m_pAreaStyle; } void XFDrawStyle::SetLineStyle(double width, XFColor color) @@ -104,6 +111,7 @@ void XFDrawStyle::SetLineDashStyle(enumXFLineStyle style, double len1, double m_pLineStyle->SetDot2Length(len2); m_pLineStyle->SetSpace(space); XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); + m_bLineStyleRegistered = true; pXFStyleManager->AddStyle(std::unique_ptr<IXFStyle>(m_pLineStyle)); } @@ -143,6 +151,7 @@ void XFDrawStyle::SetAreaLineStyle(enumXFAreaLineStyle style, sal_Int32 angle m_pAreaStyle->SetLineSpace(space); m_pAreaStyle->SetLineColor(lineColor); XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); + m_bAreaStyleRegistered = true; pXFStyleManager->AddStyle(std::unique_ptr<IXFStyle>(m_pAreaStyle)); } |