mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-24 05:44:10 +00:00
Fixed bug #8227 deref errors in tempDOMTextRange
This commit is contained in:
parent
f19dd88348
commit
9032ab797e
@ -63,16 +63,20 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
|
||||
// will hold a ref, the widget representation isn't persistent
|
||||
//
|
||||
nsIDOMTextRange** tempTextRangeList = new nsIDOMTextRange*[((nsTextEvent*)aEvent)->rangeCount];
|
||||
for(PRUint16 i=0;i<((nsTextEvent*)aEvent)->rangeCount;i++) {
|
||||
nsDOMTextRange* tempDOMTextRange = new nsDOMTextRange((((nsTextEvent*)aEvent)->rangeArray[i]).mStartOffset,
|
||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mEndOffset,
|
||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mRangeType);
|
||||
tempDOMTextRange->AddRef();
|
||||
tempTextRangeList[i] = (nsIDOMTextRange*)tempDOMTextRange;
|
||||
}
|
||||
if (tempTextRangeList!=nsnull) {
|
||||
for(PRUint16 i=0;i<((nsTextEvent*)aEvent)->rangeCount;i++) {
|
||||
nsDOMTextRange* tempDOMTextRange = new nsDOMTextRange((((nsTextEvent*)aEvent)->rangeArray[i]).mStartOffset,
|
||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mEndOffset,
|
||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mRangeType);
|
||||
if (tempDOMTextRange!=nsnull) {
|
||||
tempDOMTextRange->AddRef();
|
||||
tempTextRangeList[i] = (nsIDOMTextRange*)tempDOMTextRange;
|
||||
}
|
||||
}
|
||||
|
||||
mTextRange = (nsIDOMTextRangeList*) new nsDOMTextRangeList(((nsTextEvent*)aEvent)->rangeCount,tempTextRangeList);
|
||||
mTextRange->AddRef();
|
||||
mTextRange = (nsIDOMTextRangeList*) new nsDOMTextRangeList(((nsTextEvent*)aEvent)->rangeCount,tempTextRangeList);
|
||||
if (mTextRange!=nsnull) mTextRange->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
NS_INIT_REFCNT();
|
||||
|
@ -63,16 +63,20 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
|
||||
// will hold a ref, the widget representation isn't persistent
|
||||
//
|
||||
nsIDOMTextRange** tempTextRangeList = new nsIDOMTextRange*[((nsTextEvent*)aEvent)->rangeCount];
|
||||
for(PRUint16 i=0;i<((nsTextEvent*)aEvent)->rangeCount;i++) {
|
||||
nsDOMTextRange* tempDOMTextRange = new nsDOMTextRange((((nsTextEvent*)aEvent)->rangeArray[i]).mStartOffset,
|
||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mEndOffset,
|
||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mRangeType);
|
||||
tempDOMTextRange->AddRef();
|
||||
tempTextRangeList[i] = (nsIDOMTextRange*)tempDOMTextRange;
|
||||
}
|
||||
if (tempTextRangeList!=nsnull) {
|
||||
for(PRUint16 i=0;i<((nsTextEvent*)aEvent)->rangeCount;i++) {
|
||||
nsDOMTextRange* tempDOMTextRange = new nsDOMTextRange((((nsTextEvent*)aEvent)->rangeArray[i]).mStartOffset,
|
||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mEndOffset,
|
||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mRangeType);
|
||||
if (tempDOMTextRange!=nsnull) {
|
||||
tempDOMTextRange->AddRef();
|
||||
tempTextRangeList[i] = (nsIDOMTextRange*)tempDOMTextRange;
|
||||
}
|
||||
}
|
||||
|
||||
mTextRange = (nsIDOMTextRangeList*) new nsDOMTextRangeList(((nsTextEvent*)aEvent)->rangeCount,tempTextRangeList);
|
||||
mTextRange->AddRef();
|
||||
mTextRange = (nsIDOMTextRangeList*) new nsDOMTextRangeList(((nsTextEvent*)aEvent)->rangeCount,tempTextRangeList);
|
||||
if (mTextRange!=nsnull) mTextRange->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
NS_INIT_REFCNT();
|
||||
|
Loading…
x
Reference in New Issue
Block a user