Not part of the build. Fix text lifetime issues for transformed textruns.

This commit is contained in:
roc+@cs.cmu.edu 2007-05-09 17:58:47 -07:00
Родитель eedb90c553
Коммит 4e6c54649d
1 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -145,10 +145,20 @@ nsTransformingTextRunFactory::MakeTextRun(const PRUnichar* aString, PRUint32 aLe
gfxFontGroup* aFontGroup, PRUint32 aFlags,
nsStyleContext** aStyles)
{
PRUnichar* text = nsnull;
if (!(aFlags & gfxFontGroup::TEXT_IS_PERSISTENT)) {
text = new PRUnichar[aLength];
if (!text)
return nsnull;
memcpy(text, aString, aLength*sizeof(PRUnichar));
}
nsTransformedTextRun* textRun =
new nsTransformedTextRun(aParams, this, aFontGroup, aString, aLength, aFlags, aStyles);
if (!textRun)
new nsTransformedTextRun(aParams, this, aFontGroup,
text ? text : aString, aLength, aFlags, aStyles);
if (!textRun) {
delete[] text;
return nsnull;
}
RebuildTextRun(textRun);
return textRun;
}
@ -500,6 +510,8 @@ nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun)
// Setup actual line break data for child (which may affect shaping)
innerParams.mInitialBreaks = lineBreakBeforeArray.Elements();
innerParams.mInitialBreakCount = lineBreakBeforeArray.Length();
// The text outlives 'child'
flags |= gfxFontGroup::TEXT_IS_PERSISTENT;
if (mInnerTransformingTextRunFactory) {
child = mInnerTransformingTextRunFactory->MakeTextRun(
convertedString.BeginReading(), convertedString.Length(),