[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Mon Jan 15 18:28:20 UTC 2018


 lotuswordpro/source/filter/lwpchangemgr.cxx |    2 ++
 lotuswordpro/source/filter/lwpfrib.cxx      |   18 +++++++++++++++++-
 lotuswordpro/source/filter/lwpfrib.hxx      |    4 ++++
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit f8a1dd7ae35ea0307a9282378a9300897df6fb42
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 12 09:43:41 2018 +0000

    ofz#5254 Bad-cast
    
    Change-Id: I318d441d841dd4c783f87ac2f3f699852e8b1039
    Reviewed-on: https://gerrit.libreoffice.org/47805
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/lotuswordpro/source/filter/lwpchangemgr.cxx b/lotuswordpro/source/filter/lwpchangemgr.cxx
index 30b272e35ccc..cbd9b58aa805 100644
--- a/lotuswordpro/source/filter/lwpchangemgr.cxx
+++ b/lotuswordpro/source/filter/lwpchangemgr.cxx
@@ -89,6 +89,7 @@ LwpChangeMgr::LwpChangeMgr()
     m_pFribMap = &m_DocFribMap;
     m_ChangeList.clear();
 }
+
 LwpChangeMgr::~LwpChangeMgr()
 {
     m_pFribMap=nullptr;
@@ -102,6 +103,7 @@ void LwpChangeMgr::AddChangeFrib(LwpFrib* pFrib)
     m_nCounter++;
     OUString sID = "ct"+ OUString::number(m_nCounter);
     m_pFribMap->insert(std::pair<LwpFrib*,OUString>(pFrib,sID));
+    pFrib->Register(m_pFribMap);
 }
 
 OUString LwpChangeMgr::GetChangeID(LwpFrib* pFrib)
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
index bd951118d48d..baebf753ed03 100644
--- a/lotuswordpro/source/filter/lwpfrib.cxx
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -87,7 +87,8 @@
 
 
 LwpFrib::LwpFrib(LwpPara* pPara)
-    : m_pPara(pPara)
+    : m_pFribMap(nullptr)
+    , m_pPara(pPara)
     , m_pNext(nullptr)
     , m_nFribType(0)
     , m_pModifiers(nullptr)
@@ -100,6 +101,7 @@ LwpFrib::LwpFrib(LwpPara* pPara)
 
 LwpFrib::~LwpFrib()
 {
+    Deregister();
 }
 
 LwpFrib* LwpFrib::CreateFrib(LwpPara* pPara, LwpObjectStream* pObjStrm, sal_uInt8 fribtag,sal_uInt8 editID)
@@ -447,4 +449,18 @@ XFColor LwpFrib::GetHighlightColor()
     return pGlobal->GetHighlightColor(m_nEditor);
 }
 
+void LwpFrib::Register(std::map<LwpFrib*,OUString>* pFribMap)
+{
+    m_pFribMap = pFribMap;
+}
+
+void LwpFrib::Deregister()
+{
+    if (m_pFribMap)
+    {
+        m_pFribMap->erase(this);
+        m_pFribMap = nullptr;
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfrib.hxx b/lotuswordpro/source/filter/lwpfrib.hxx
index 910f85dee08f..6fde006a649e 100644
--- a/lotuswordpro/source/filter/lwpfrib.hxx
+++ b/lotuswordpro/source/filter/lwpfrib.hxx
@@ -97,6 +97,7 @@ public:
     OUString GetEditor();
     XFColor GetHighlightColor();
 protected:
+    std::map<LwpFrib*,OUString>* m_pFribMap;
     LwpPara* m_pPara;
     LwpFrib* m_pNext;
     sal_uInt8 m_nFribType;
@@ -119,6 +120,9 @@ public:
         REV_INSERT =0,
         REV_DELETE = 1,
     };
+
+    void Register(std::map<LwpFrib*,OUString>* pFribMap);
+    void Deregister();
 private:
     static void ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo);
 protected:


More information about the Libreoffice-commits mailing list