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

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


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

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

    hold bullet para by reference
    
    (cherry picked from commit c9a04aed449c3cf992224cfedcee7f330357b01a)
    
    Change-Id: I58025ea906426a7db4079042fa38954f1a3d076b
    Reviewed-on: https://gerrit.libreoffice.org/23799
    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 e7ad33f..eb7c04af 100644
--- a/lotuswordpro/source/filter/lwpsilverbullet.cxx
+++ b/lotuswordpro/source/filter/lwpsilverbullet.cxx
@@ -76,16 +76,12 @@ LwpSilverBullet::LwpSilverBullet(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
     , m_nFlags(0)
     , m_nUseCount(0)
     , m_pAtomHolder(new LwpAtomHolder)
-    , m_pBulletPara(NULL)
 {
 }
 
 LwpSilverBullet::~LwpSilverBullet()
 {
-    if (m_pAtomHolder)
-    {
-        delete m_pAtomHolder;
-    }
+    delete m_pAtomHolder;
 }
 
 void LwpSilverBullet::Read()
@@ -129,7 +125,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)
             {
@@ -205,7 +201,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?
@@ -226,7 +222,7 @@ OUString LwpSilverBullet::GetBulletFontName()
  */
 UChar32 LwpSilverBullet::GetBulletChar()
 {
-    OUString aBulletChar = m_pBulletPara->GetBulletChar();
+    OUString aBulletChar = m_xBulletPara->GetBulletChar();
 
     return aBulletChar.toChar();
 }
@@ -236,7 +232,7 @@ UChar32 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)
@@ -244,10 +240,10 @@ LwpPara* LwpSilverBullet::GetBulletPara()
             return NULL;
         }
 
-        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();
 }
 
 /**
@@ -328,10 +324,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) != NULL);
 }
@@ -374,7 +370,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 aEmpty;
diff --git a/lotuswordpro/source/filter/lwpsilverbullet.hxx b/lotuswordpro/source/filter/lwpsilverbullet.hxx
index c56f35e..c8fbcde 100644
--- a/lotuswordpro/source/filter/lwpsilverbullet.hxx
+++ b/lotuswordpro/source/filter/lwpsilverbullet.hxx
@@ -142,7 +142,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];
 
@@ -167,7 +167,7 @@ inline OUString LwpSilverBullet::GetNumberingName()
 }
 inline LwpPara* LwpSilverBullet::GetNumberingPara()
 {
-    return m_pBulletPara;
+    return m_xBulletPara.get();
 }
 inline bool LwpSilverBullet::IsPosCumulative(sal_uInt16 nHideLevels)
 {


More information about the Libreoffice-commits mailing list