Re: CVS: commit tomas_f abi/src/text/fmt/xp fp_TextRun.cpp

From: <msevior_at_physics.unimelb.edu.au>
Date: Fri Sep 30 2005 - 00:30:07 CEST

>

Thanks Tomas,
            This was the right thing to do. Valgrind was giving me an
invalid pointer issue for m_pszLanguage while debugging
only-grammar check english. I put in the strdup's to solve
this. Later I found that something was wrong with the actual
block pointers but I left this code in place because
everything was working...

Sorry.

Martin

> Update of /cvsroot/abi/src/text/fmt/xp
> In directory abiword.snt.utwente.nl:/tmp/cvs-serv26984
>
> Modified Files:
> fp_TextRun.cpp
> Log Message:
> revert 1.359 and 1.361
>
> Index: fp_TextRun.cpp
> ===================================================================
> RCS file: /cvsroot/abi/src/text/fmt/xp/fp_TextRun.cpp,v
> retrieving revision 1.361
> retrieving revision 1.362
> diff -u -d -r1.361 -r1.362
> --- fp_TextRun.cpp 28 Sep 2005 19:37:14 -0000 1.361
> +++ fp_TextRun.cpp 29 Sep 2005 09:33:07 -0000 1.362
> @@ -101,8 +101,6 @@
> xxx_UT_DEBUGMSG(("!!!!!!!! Text run %x deleted \n",this));
> DELETEP(m_pRenderInfo);
> DELETEP(m_pItem);
> - FREEP(m_pLanguage);
> - m_pLanguage = NULL;
> }
>
> bool fp_TextRun::hasLayoutProperties(void) const
> @@ -250,10 +248,13 @@
> UT_Language lls;
> const XML_Char * pszLanguage =
> PP_evalProperty("lang",pSpanAP,pBlockAP,pSectionAP, pDoc, true);
>
> + // NB: m_pLanguage is a pointer into static tables inside UT_Language
> class and as
> + // such has a guaranteed life-span same as the application; hence no
> strdup here and
> + // no strcmp later
> const XML_Char * pszOldLanguage = m_pLanguage;
> - const XML_Char * pszNewLanguage =
> UT_strdup(lls.getCodeFromCode(pszLanguage));
> - xxx_UT_DEBUGMSG(("!!!!!!!! Language of run set to %s pointer %x run %x
> \n",getLanguage(),pszNewLanguage,this));
> - if(pszOldLanguage && (UT_strcmp(pszNewLanguage,pszOldLanguage) != 0))
> + m_pLanguage = lls.getCodeFromCode(pszLanguage);
> + xxx_UT_DEBUGMSG(("!!!!!!!! Language of run set to %s pointer %x run %x
> \n",getLanguage(),m_pLanguage,this));
> + if(pszOldLanguage && (m_pLanguage != pszOldLanguage))
> {
> UT_uint32 reason = 0;
> if( getBlock()->getDocLayout()->getAutoSpellCheck())
> @@ -267,8 +268,6 @@
> getBlock()->getDocLayout()->queueBlockForBackgroundCheck(reason,
> getBlock());
> bChanged = true;
> }
> - FREEP(m_pLanguage);
> - m_pLanguage = pszNewLanguage;
>
>
> UT_BidiCharType iOldOverride = m_iDirOverride;
> @@ -946,7 +945,8 @@
> || (pNext->_getFont() != _getFont())
> || (getHeight() != pNext->getHeight())
> || (pNext->getField() != getField())
> - || (UT_strcmp(pNext->m_pLanguage,m_pLanguage) != 0) //this is not a bug
> + || (pNext->m_pLanguage != m_pLanguage) //this is not a bug; see
> m_pLanguage in
> + //fp_TextRun.h before modifying this line
> || (pNext->_getColorFG() != _getColorFG())
> || (pNext->_getColorHL() != _getColorHL())
> || (pNext->_getColorHL().isTransparent() !=
> _getColorHL().isTransparent())
> @@ -1011,7 +1011,8 @@
> UT_ASSERT(getDescent() == pNext->getDescent());
> UT_ASSERT(getHeight() == pNext->getHeight());
> UT_ASSERT(_getLineWidth() == pNext->_getLineWidth());
> - UT_ASSERT(UT_strcmp(m_pLanguage,pNext->m_pLanguage) == 0); //this is not
> a bug
> + UT_ASSERT(m_pLanguage == pNext->m_pLanguage); //this is not a bug; see
> m_pLanguage in
> + //fp_TextRun.h before
> modifying this line
> UT_ASSERT(m_fPosition == pNext->m_fPosition);
> UT_ASSERT(m_iDirOverride == pNext->m_iDirOverride); //#TF
> //UT_ASSERT(m_iSpaceWidthBeforeJustification ==
> pNext->m_iSpaceWidthBeforeJustification);
> @@ -1144,8 +1145,7 @@
> pNew->_setHeight(this->getHeight());
> pNew->_setLineWidth(this->_getLineWidth());
> pNew->_setDirty(true);
> - FREEP(pNew->m_pLanguage);
> - pNew->m_pLanguage = UT_strdup(this->m_pLanguage);
> + pNew->m_pLanguage = this->m_pLanguage;
> xxx_UT_DEBUGMSG(("!!!!--- Run %x gets Language pointer %x
> \n",pNew,pNew->m_pLanguage));
> pNew->_setDirection(this->_getDirection()); //#TF
> pNew->m_iDirOverride = this->m_iDirOverride;
>
> -----------------------------------------------
> To unsubscribe from this list, send a message to
> abisource-cvs-commit-request@abisource.com with the word
> unsubscribe in the message body.
>
Received on Fri Sep 30 00:31:03 2005

This archive was generated by hypermail 2.1.8 : Fri Sep 30 2005 - 00:31:04 CEST