diff options
| author | Marc Mutz <marc.mutz@kdab.com> | 2015-01-08 21:26:08 +0100 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-01-17 06:31:54 +0100 |
| commit | 3d8a10b9602f10be747ffb64d3ce593837e66df4 (patch) | |
| tree | 468f248e2b8e979191cfdfdebb7385163220da54 /src/gui/opengl/qopengltexture.cpp | |
| parent | 9d46189a64769d44842accfe427ebf5cdbc9d73b (diff) | |
QHash: only fetch qt_qhash_seed when detaching from a null QHash
The old code fetched QHashData::seed from qt_qhash_seed on every detach.
That is both unnecessary and wrong.
It is uneccessary, because if the detached-from QHashData isn't shared_null,
the seed has already been populated from qt_qhash_seed. It thus suffices to
fetch the seed from qt_qhash_seed only when we detach from shared_null.
It is wrong, because if qt_qhash_seed was changed between the detach from
shared_null and a following detach, d->seed is now different from this->seed,
but detach_helper simply clones the buckets 1:1 from this to d, leaving d
in a corrupt state.
By doing this change, we make QHash robust against on-the-fly changes
to qt_qhash_seed (e.g. for testing, or added security). It also opens up the
option to have API for changing the seed of a given QHash instance after it
has been created (detach, set new seed, rehash).
Change-Id: Ib251fc9a6204b42036e97a2fc66f644b379ab841
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/opengl/qopengltexture.cpp')
0 files changed, 0 insertions, 0 deletions
