Closed Bug 1691910 Opened 4 years ago Closed 4 years ago

Use of GetOrInsert in ChannelCountReporter::Decrement seems wrong

Categories

(Core :: IPC, defect)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: sg, Unassigned)

References

(Regression)

Details

(Keywords: regression)

At https://searchfox.org/mozilla-central/rev/7067bbd8194f4346ec59d77c33cd88f06763e090/ipc/glue/MessageChannel.cpp#541, we might insert a default-constructed entry, and then try to decrement it. This would fail the debug assertion at https://searchfox.org/mozilla-central/rev/7067bbd8194f4346ec59d77c33cd88f06763e090/ipc/glue/MessageChannel.cpp#490, and wrap mNow to SIZE_MAX in non-debug builds.

It seems more appropriate to use Get instead of GetOrInsert in the first place, since a new entry should not be inserted here.

Sorry, I just realized that Get returns the UserDataType by value, and GetOrInsert returns a DataType& (a reference to the actual stored value), which is required here. This seems somewhat confusing.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
See Also: → 1691913
Has Regression Range: --- → yes
Keywords: regression
You need to log in before you can comment on or make changes to this bug.