String's implicit conversion operator causes COW relocations
Categories
(Core :: XPCOM, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox91 | --- | fixed |
People
(Reporter: nika, Assigned: nika)
Details
Attachments
(1 file)
The operator Span<char_type>
operator defined on nsTSubstring
in bug 1295611 implicitly invokes BeginWriting()
which can relocate the string's backing buffer to make it writable. This means that any code which casts a non-const
nsTSubstring
to a Span<char_type>
will make the string owned.
We shouldn't do this kind of relocation implicitly, as it can be done accidentally very easily, such as when a user is intending to use operator Span<const char_type>
. This patch tracks changing uses of the non-const
operator to be explicit calls instead.
Assignee | ||
Comment 1•4 years ago
|
||
Comment 3•4 years ago
|
||
Backed out changeset 3beb01f5d643 (Bug 1717526) for causing gtest failures in SpanTest.from_xpcom_collections
Backout link: https://hg.mozilla.org/integration/autoland/rev/15b20f4cd02f9497f40e3dfe06adbc9dab1eb050
Push with failures, failure log.
Assignee | ||
Updated•4 years ago
|
Comment 5•4 years ago
|
||
bugherder |
Description
•