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

Caolán McNamara caolanm at redhat.com
Tue Apr 5 05:48:36 UTC 2016


 lotuswordpro/qa/cppunit/data/fail/reference-1.lwp |binary
 lotuswordpro/source/filter/lwpsilverbullet.cxx    |   24 +++++++++-------------
 lotuswordpro/source/filter/lwpsilverbullet.hxx    |    2 -
 3 files changed, 11 insertions(+), 15 deletions(-)

New commits:
commit c326d9bb95b48c679bd3af4d044569d3ed47137b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 4 09:34:36 2016 +0100

    hold bullet para by reference
    
    Change-Id: I58025ea906426a7db4079042fa38954f1a3d076b
    (cherry picked from commit c9a04aed449c3cf992224cfedcee7f330357b01a)
    Reviewed-on: https://gerrit.libreoffice.org/23798
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp
new file mode 100644
index 0000000..d8141ae
Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp differ
diff --git a/lotuswordpro/source/filter/lwpsilverbullet.cxx b/lotuswordpro/source/filter/lwpsilverbullet.cxx
index 01a9253..a0469d9 100644
--- a/lotuswordpro/source/filter/lwpsilverbullet.cxx
+++ b/lotuswordpro/source/filter/lwpsilverbullet.cxx
@@ -73,16 +73,12 @@ LwpSilverBullet::LwpSilverBullet(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
     , m_nFlags(0)
     , m_nUseCount(0)
     , m_pAtomHolder(new LwpAtomHolder)
-    , m_pBulletPara(nullptr)
 {
 }
 
 LwpSilverBullet::~LwpSilverBullet()
 {
-    if (m_pAtomHolder)
-    {
-        delete m_pAtomHolder;
-    }
+    delete m_pAtomHolder;
 }
 
 void LwpSilverBullet::Read()
@@ -126,7 +122,7 @@ void LwpSilverBullet::RegisterStyle()
         {
             ParaNumbering aParaNumbering;
             //get numbering format according to the position.
-            m_pBulletPara->GetParaNumber(nPos, &aParaNumbering);
+            m_xBulletPara->GetParaNumber(nPos, &aParaNumbering);
             LwpFribParaNumber* pParaNumber = aParaNumbering.pParaNumber;
             if (pParaNumber)
             {
@@ -200,7 +196,7 @@ OUString LwpSilverBullet::GetBulletFontName()
 
     LwpFontManager& rFontMgr = m_pFoundry->GetFontManger();
 
-    sal_uInt32 nBulletFontID = m_pBulletPara->GetBulletFontID();
+    sal_uInt32 nBulletFontID = m_xBulletPara->GetBulletFontID();
     sal_uInt16 nFinalFont = static_cast<sal_uInt16>((nBulletFontID >> 16) & 0xFFFF);
 
     //final fontid is valid?
@@ -221,7 +217,7 @@ OUString LwpSilverBullet::GetBulletFontName()
  */
 OUString LwpSilverBullet::GetBulletChar()
 {
-    return m_pBulletPara->GetBulletChar();
+    return m_xBulletPara->GetBulletChar();
 }
 
 /**
@@ -229,7 +225,7 @@ OUString LwpSilverBullet::GetBulletChar()
  */
 LwpPara* LwpSilverBullet::GetBulletPara()
 {
-    if (!m_pBulletPara)
+    if (!m_xBulletPara.is())
     {
         LwpStory* pStory = dynamic_cast<LwpStory*>(m_aStory.obj(VO_STORY).get());
         if (!pStory)
@@ -237,10 +233,10 @@ LwpPara* LwpSilverBullet::GetBulletPara()
             return nullptr;
         }
 
-        m_pBulletPara = dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj(VO_PARA).get());
+        m_xBulletPara.set(dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj(VO_PARA).get()));
     }
 
-    return m_pBulletPara;
+    return m_xBulletPara.get();
 }
 
 /**
@@ -317,10 +313,10 @@ OUString LwpSilverBullet::GetNumCharByStyleID(LwpFribParaNumber* pParaNumber)
  */
 bool LwpSilverBullet::IsBulletOrdered()
 {
-    if (!m_pBulletPara)
+    if (!m_xBulletPara.is())
         return false;
 
-    LwpFribPtr& rFribs = m_pBulletPara->GetFribs();
+    LwpFribPtr& rFribs = m_xBulletPara->GetFribs();
 
     return (rFribs.HasFrib(FRIB_TAG_PARANUMBER) != nullptr);
 }
@@ -363,7 +359,7 @@ OUString LwpSilverBullet::GetAdditionalName(sal_uInt8 nPos)
     bool bDivisionName = false;
     bool bSectionName = false;
 
-    LwpFrib* pParaFrib = m_pBulletPara->GetFribs().GetFribs();
+    LwpFrib* pParaFrib = m_xBulletPara->GetFribs().GetFribs();
     if (!pParaFrib)
     {
         return OUString();
diff --git a/lotuswordpro/source/filter/lwpsilverbullet.hxx b/lotuswordpro/source/filter/lwpsilverbullet.hxx
index 8d73096..8ddbf87 100644
--- a/lotuswordpro/source/filter/lwpsilverbullet.hxx
+++ b/lotuswordpro/source/filter/lwpsilverbullet.hxx
@@ -138,7 +138,7 @@ private:
     sal_uInt32      m_nUseCount;
     LwpAtomHolder*  m_pAtomHolder;
 
-    LwpPara* m_pBulletPara;
+    rtl::Reference<LwpPara> m_xBulletPara;
     OUString m_strStyleName;
     sal_uInt16 m_pHideLevels[10];
 


More information about the Libreoffice-commits mailing list