зеркало из https://github.com/mozilla/pjs.git
Fixed bug #8227 deref errors in tempDOMTextRange
This commit is contained in:
Родитель
eb7bd157bc
Коммит
e1cd6e87e7
|
@ -63,16 +63,20 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
|
||||||
// will hold a ref, the widget representation isn't persistent
|
// will hold a ref, the widget representation isn't persistent
|
||||||
//
|
//
|
||||||
nsIDOMTextRange** tempTextRangeList = new nsIDOMTextRange*[((nsTextEvent*)aEvent)->rangeCount];
|
nsIDOMTextRange** tempTextRangeList = new nsIDOMTextRange*[((nsTextEvent*)aEvent)->rangeCount];
|
||||||
for(PRUint16 i=0;i<((nsTextEvent*)aEvent)->rangeCount;i++) {
|
if (tempTextRangeList!=nsnull) {
|
||||||
nsDOMTextRange* tempDOMTextRange = new nsDOMTextRange((((nsTextEvent*)aEvent)->rangeArray[i]).mStartOffset,
|
for(PRUint16 i=0;i<((nsTextEvent*)aEvent)->rangeCount;i++) {
|
||||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mEndOffset,
|
nsDOMTextRange* tempDOMTextRange = new nsDOMTextRange((((nsTextEvent*)aEvent)->rangeArray[i]).mStartOffset,
|
||||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mRangeType);
|
(((nsTextEvent*)aEvent)->rangeArray[i]).mEndOffset,
|
||||||
tempDOMTextRange->AddRef();
|
(((nsTextEvent*)aEvent)->rangeArray[i]).mRangeType);
|
||||||
tempTextRangeList[i] = (nsIDOMTextRange*)tempDOMTextRange;
|
if (tempDOMTextRange!=nsnull) {
|
||||||
}
|
tempDOMTextRange->AddRef();
|
||||||
|
tempTextRangeList[i] = (nsIDOMTextRange*)tempDOMTextRange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mTextRange = (nsIDOMTextRangeList*) new nsDOMTextRangeList(((nsTextEvent*)aEvent)->rangeCount,tempTextRangeList);
|
mTextRange = (nsIDOMTextRangeList*) new nsDOMTextRangeList(((nsTextEvent*)aEvent)->rangeCount,tempTextRangeList);
|
||||||
mTextRange->AddRef();
|
if (mTextRange!=nsnull) mTextRange->AddRef();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
|
|
@ -63,16 +63,20 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
|
||||||
// will hold a ref, the widget representation isn't persistent
|
// will hold a ref, the widget representation isn't persistent
|
||||||
//
|
//
|
||||||
nsIDOMTextRange** tempTextRangeList = new nsIDOMTextRange*[((nsTextEvent*)aEvent)->rangeCount];
|
nsIDOMTextRange** tempTextRangeList = new nsIDOMTextRange*[((nsTextEvent*)aEvent)->rangeCount];
|
||||||
for(PRUint16 i=0;i<((nsTextEvent*)aEvent)->rangeCount;i++) {
|
if (tempTextRangeList!=nsnull) {
|
||||||
nsDOMTextRange* tempDOMTextRange = new nsDOMTextRange((((nsTextEvent*)aEvent)->rangeArray[i]).mStartOffset,
|
for(PRUint16 i=0;i<((nsTextEvent*)aEvent)->rangeCount;i++) {
|
||||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mEndOffset,
|
nsDOMTextRange* tempDOMTextRange = new nsDOMTextRange((((nsTextEvent*)aEvent)->rangeArray[i]).mStartOffset,
|
||||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mRangeType);
|
(((nsTextEvent*)aEvent)->rangeArray[i]).mEndOffset,
|
||||||
tempDOMTextRange->AddRef();
|
(((nsTextEvent*)aEvent)->rangeArray[i]).mRangeType);
|
||||||
tempTextRangeList[i] = (nsIDOMTextRange*)tempDOMTextRange;
|
if (tempDOMTextRange!=nsnull) {
|
||||||
}
|
tempDOMTextRange->AddRef();
|
||||||
|
tempTextRangeList[i] = (nsIDOMTextRange*)tempDOMTextRange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mTextRange = (nsIDOMTextRangeList*) new nsDOMTextRangeList(((nsTextEvent*)aEvent)->rangeCount,tempTextRangeList);
|
mTextRange = (nsIDOMTextRangeList*) new nsDOMTextRangeList(((nsTextEvent*)aEvent)->rangeCount,tempTextRangeList);
|
||||||
mTextRange->AddRef();
|
if (mTextRange!=nsnull) mTextRange->AddRef();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче