qt5base-lts/tests/auto/corelib/kernel
Fabian Kosmale cb30e45b9a Avoid capturing same property twice
Avoid capturing the same property multiple times in a binding by
storing them in the BindingEvaluationState. We store them in a
QVarLengthArray array, as the number of properties involved in a binding
is expected to be rather low, so a linear scan is fine.

Avoiding double capture is a good idea in general, as we would otherwise
needlessly reevaluate bindings multiple times, and also needlessly
allocate memory for further observers, instead of using a binding's
inline observer array.

Even more importantantly, our notification code makes assumptions that
notify will visit bindings only exactly once. Not upholding that
invariant leads to memory corruption and subsequent crashes, as
observers allocated by the binding would get freed, even though we would
still access them later.

Fixes: QTBUG-112822
Pick-to: 6.5 6.2
Change-Id: Icdc1f43fe554df6fa69e881872b2c429d5fa0bbc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-04-18 13:23:48 +02:00
..
qapplicationstatic Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qcoreapplication tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qdeadlinetimer tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qelapsedtimer tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qeventdispatcher QThread: add sleep(std::chrono::nanoseconds) overload 2023-03-13 23:26:28 +02:00
qeventloop tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qjnienvironment CMake: Remove direct qt_android_generate_deployment_settings call 2022-12-15 20:23:28 +01:00
qjniobject CMake: Remove direct qt_android_generate_deployment_settings call 2022-12-15 20:23:28 +01:00
qjnitypes JNI: add generic support for array-types 2022-10-10 20:19:30 +02:00
qmath tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qmetacontainer tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qmetaenum tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qmetamethod tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qmetaobject tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qmetaobjectbuilder moc: Record types of enumerations 2023-03-31 17:42:58 +02:00
qmetaproperty tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qmetatype QMetaType: Provide underlyingType for enums 2023-03-28 10:59:53 +02:00
qmimedata tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qobject Make it possible to use QObjectPrivate::connect in private code 2023-03-10 15:39:37 +01:00
qpermission Permissions: respect context object's thread and life time 2023-04-06 00:21:50 +02:00
qpointer tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qproperty Avoid capturing same property twice 2023-04-18 13:23:48 +02:00
qsignalblocker tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qsignalmapper tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qsocketnotifier QTestEventLoop: add enterLoop(std::chrono::milliseconds) overload 2023-03-03 21:36:48 +02:00
qtimer Fix QTimer::crossThreadSingleShotToFunctor test 2023-03-30 19:17:25 +02:00
qtranslator tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qvariant tst_QVariant: add a test contrasting Qt 5/6 isNull behavior 2023-03-24 06:40:27 +01:00
qwineventnotifier tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qwinregistrykey QWinRegistryKey: Fix how we handle the default value, take 2 2022-10-28 09:27:13 +00:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00