bug 85487, M091 crash at line breaker [@ nsJISx4501LineBreaker::Next],

r=ftang, sr=waterson, a=asa
This commit is contained in:
loadrunner%betak.net 2001-06-19 22:57:50 +00:00
Родитель 0793323929
Коммит 91c70ee453
2 изменённых файлов: 46 добавлений и 24 удалений

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

@ -5301,20 +5301,30 @@ nsTextFrame::ComputeTotalWordWidth(nsIPresContext* aPresContext,
newWordBufSize += moreSize;
if (newWordBuf != aWordBuf) {
newWordBuf = (PRUnichar*)nsMemory::Realloc(newWordBuf, sizeof(PRUnichar)*newWordBufSize);
NS_ASSERTION(newWordBuf, "not enough memory");
} else {
newWordBuf = (PRUnichar*)nsMemory::Alloc(sizeof(PRUnichar)*newWordBufSize);
nsCRT::memcpy((void*)newWordBuf, aWordBuf, sizeof(PRUnichar)*newWordBufSize-moreSize);
NS_ASSERTION(newWordBuf, "not enough memory");
if(newWordBuf) {
nsCRT::memcpy((void*)newWordBuf, aWordBuf, sizeof(PRUnichar)*(newWordBufSize-moreSize));
}
}
moreWidth = ComputeWordFragmentWidth(aPresContext,
aLineBreaker,
aLineLayout,
aReflowState,
aNextFrame, content, tc,
&stop,
newWordBuf,
aWordLen,
newWordBufSize);
NS_ASSERTION((moreWidth >= 0), "ComputeWordFragmentWidth is returning negative");
if(newWordBuf) {
moreWidth = ComputeWordFragmentWidth(aPresContext,
aLineBreaker,
aLineLayout,
aReflowState,
aNextFrame, content, tc,
&stop,
newWordBuf,
aWordLen,
newWordBufSize);
NS_ASSERTION((moreWidth >= 0), "ComputeWordFragmentWidth is returning negative");
} else {
stop = PR_TRUE;
moreWidth = 0;
}
}
NS_RELEASE(tc);
@ -5345,8 +5355,9 @@ nsTextFrame::ComputeTotalWordWidth(nsIPresContext* aPresContext,
#ifdef DEBUG_WORD_WRAPPING
printf(" total word width=%d\n", aBaseWidth + addedWidth);
#endif
if (newWordBuf != aWordBuf)
if (newWordBuf && (newWordBuf != aWordBuf)) {
nsMemory::Free(newWordBuf);
}
return aBaseWidth + addedWidth;
}

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

@ -5301,20 +5301,30 @@ nsTextFrame::ComputeTotalWordWidth(nsIPresContext* aPresContext,
newWordBufSize += moreSize;
if (newWordBuf != aWordBuf) {
newWordBuf = (PRUnichar*)nsMemory::Realloc(newWordBuf, sizeof(PRUnichar)*newWordBufSize);
NS_ASSERTION(newWordBuf, "not enough memory");
} else {
newWordBuf = (PRUnichar*)nsMemory::Alloc(sizeof(PRUnichar)*newWordBufSize);
nsCRT::memcpy((void*)newWordBuf, aWordBuf, sizeof(PRUnichar)*newWordBufSize-moreSize);
NS_ASSERTION(newWordBuf, "not enough memory");
if(newWordBuf) {
nsCRT::memcpy((void*)newWordBuf, aWordBuf, sizeof(PRUnichar)*(newWordBufSize-moreSize));
}
}
moreWidth = ComputeWordFragmentWidth(aPresContext,
aLineBreaker,
aLineLayout,
aReflowState,
aNextFrame, content, tc,
&stop,
newWordBuf,
aWordLen,
newWordBufSize);
NS_ASSERTION((moreWidth >= 0), "ComputeWordFragmentWidth is returning negative");
if(newWordBuf) {
moreWidth = ComputeWordFragmentWidth(aPresContext,
aLineBreaker,
aLineLayout,
aReflowState,
aNextFrame, content, tc,
&stop,
newWordBuf,
aWordLen,
newWordBufSize);
NS_ASSERTION((moreWidth >= 0), "ComputeWordFragmentWidth is returning negative");
} else {
stop = PR_TRUE;
moreWidth = 0;
}
}
NS_RELEASE(tc);
@ -5345,8 +5355,9 @@ nsTextFrame::ComputeTotalWordWidth(nsIPresContext* aPresContext,
#ifdef DEBUG_WORD_WRAPPING
printf(" total word width=%d\n", aBaseWidth + addedWidth);
#endif
if (newWordBuf != aWordBuf)
if (newWordBuf && (newWordBuf != aWordBuf)) {
nsMemory::Free(newWordBuf);
}
return aBaseWidth + addedWidth;
}