qt5base-lts/tests/auto/corelib
Marc Mutz e297e80fd0 QVarLengthArray: make reallocation strongly exception safe
The old code had several bugs:

- it immediately clobbered *this with new state, before having copied
  over the elements from the old to the new buffer

- when buffer relocation threw, it would keep the new (partially-filled)
  buffer and throw away the old

- it unconditionally used std::move() for non-relocatable types, making
  it impossible to restore the original buffer when a move throws

Instead of clobbering *this with new state, do all the work on the
side and change *this only once the reallocation has happened
successfully.

Also use q_uninitialized_relocate_n() and unique_ptr in the
implementation to simplify the code. The former got the necessary
update to use std::move_if_noexcept() instead of an unconditional
std::move() for the non-relocatable case.

[ChangeLog][QtCore][QVarLengthArray] The append()-like functions are
now strongly exception safe. This means reallocation will now use
copies instead of moves, unless the value_type has a noexcept move
constructor.

Fixes: QTBUG-99039
Change-Id: I031251b8d14ac045592d01caed59d4638c3d9892
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 18:59:55 +00:00
..
animation Include qproperty.h where needed 2021-11-04 21:45:02 +01:00
global Fix tst_qfloat16 runtime failure for INTEGRITY 2021-12-06 18:53:50 +00:00
io QFile: Add open() overload that accepts permissions argument 2021-12-04 01:27:11 +01:00
itemmodels Shorten target name for qsortfilterproxymodel auto tests 2021-11-29 08:08:21 +01:00
kernel tst_qmetatype: factor the most expensive test into its own TU 2021-12-07 15:57:33 +01:00
mimetypes Compile autotests for Integrity 2021-09-20 17:29:04 +03:00
platform Android: Add runOnMainAndroidThread() under QNativeInterface 2021-05-26 23:24:11 +00:00
plugin QNX: check and use elf.h from alternative location 2021-11-30 14:37:52 +02:00
serialization Remove conditioning on Android embedded 2021-09-17 17:30:14 +02:00
text QLocale: Extend support for language codes 2021-12-09 03:45:08 +01:00
thread QThread::create(): request interruption and join on destruction 2021-12-07 16:56:49 +01:00
time Skip QTimeZone::checkOffset() if there are no valid zones to test 2021-11-26 02:14:52 +01:00
tools QVarLengthArray: make reallocation strongly exception safe 2021-12-09 18:59:55 +00:00
CMakeLists.txt Add tests for QAndroidApplication's sdkVersion and activity 2021-05-13 01:41:36 +03:00