Closed Bug 227780 Opened 21 years ago Closed 21 years ago

[FIXr]nsCOMArray::ReplaceObjectAt could be safer

Categories

(Core :: XPCOM, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.7alpha

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file)

This function releases the old object before addreffing the new one.  If old ==
new and the caller is not holding a ref to it (eg
array.ReplaceObjectAt(array[i], i)) then the object will die.
Attachment #137026 - Flags: superreview?(alecf)
Attachment #137026 - Flags: review?(timeless)
OS: Linux → All
Priority: -- → P1
Hardware: PC → All
Target Milestone: --- → mozilla1.7alpha
Attachment #137026 - Flags: review?(timeless) → review+
Comment on attachment 137026 [details] [diff] [review]
Sorta like this-ish

I don't suppose its worth putting another branch in there to avoid the extra
addref/release?
Probably not.  Inserting an object at the same spot should be a rare case, I
would imagine.
Comment on attachment 137026 [details] [diff] [review]
Sorta like this-ish

ok, I defer to bz's better judgement :)

sr=alecf
Attachment #137026 - Flags: superreview?(alecf) → superreview+
Summary: [FIX]nsCOMArray::ReplaceObjectAt could be safer → [FIXr]nsCOMArray::ReplaceObjectAt could be safer
Checked in for 1.7a.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: