diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2025-01-23 19:07:51 +0100 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2025-01-29 18:43:40 +0100 |
| commit | 15154fa4c5d216b1c943a3b37be24f5fb2e4fa73 (patch) | |
| tree | c09539a7a76ba44ca2f30db514159b1612c98187 /src/corelib/serialization/qdatastream.cpp | |
| parent | acd331cd15785dda444b1a34f343a42c6b3c89fe (diff) | |
QDuplicateTracker: don't value-initialize the stack buffer
The typical usage of a QDuplicateTracker should be to pass the
guesstimate for the number of entries as a constructor argument, or,
failing that, default-construct the object. In those cases, everything
is peachy:
QDuplicateTracker<int> seen(n);
QDuplicateTracker<int> seen;
But for users that subscribe to a AAA view and use
auto seen = QDuplicateTracker<int>{};
or that emplace() a QDuplicateTracker in e.g. std::optional, we need
to make sure that value-initializing QDuplicateTracker doesn't
value-initialize the internal buffer (which can be several KiB in
size).
So don't = default the default ctor, but implement it as empty.
Amends f21a6d409ea0504c64cd72861fc16b6f3e080086.
Pick-to: 6.9 6.8 6.5 6.2 5.15
Change-Id: I930f40d2bb85b74d2216378d8b8ca854a53a49e4
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/serialization/qdatastream.cpp')
0 files changed, 0 insertions, 0 deletions
