Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
8
-
Team 2 Foundation_Sprint 48, Team Two Foundation Sprint 49, Team Two Foundation Sprint 50, Team Two Foundation Sprint 51
Description
The utf16() function guarantees a NUL-terminated UTF-16 string, and will reallocate when it can't be sure (most prominently, from objects constructed fromRawData()). Some code uses this function just because it returns a ushort* instead of a (const) QChar*, to avoid a reinterpret_cast, but invokes the detach() path for common QString objects such as {{QStringLiteral}}s.
So, search for, and replace with QString::(const)data(), all uses of QString::utf16() that don't actually need the NUL-termination.
QStringView::utf16() is not affected, and should stay.
The casual use of utf16() has caused QTBUG-98653. Who knows what else is brewing.