Go to file
Marc Mutz b528f9b1c6 tst_QFuture: fix UB (call of member function on wrong object)
By the time QObject::destroyed() is emitted from ~QObject(), sender no
longer is-a SenderObject, only a QObject, so calling a SenderObject
member function on it is UB.

Says UBSan:

    tst_qfuture.cpp:3854:84: runtime error: member call on address 0x60200000e550 which does not point to an object of type 'SenderObject'
     0x60200000e550: note: object is of type 'QObject'
      00 00 00 00  e8 3f 96 c9 51 7f 00 00  80 3e 00 00 c0 60 00 00  02 11 00 00 08 00 00 00  16 00 00 72
                   ^~~~~~~~~~~~~~~~~~~~~~~
                   vptr for 'QObject'

Fix by removing the QObject::connect().

This, of course, breaks the test's WHEN, but I don't see how to keep
that WHEN without the UB. At least the THEN part is not invalidated,
and there doesn't appear to be another test that tests that destroying
objects before signal emission results in a cancelled future.

Amends 612f6999c8.

Change-Id: I38ca4611c071e8fd200393b600210e36d4030bc6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4b0261fed0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-22 05:36:59 +00:00
.github/workflows Repair github action workflow 2021-11-10 18:57:33 +01:00
bin Add simple project generation based on existing source files 2023-02-08 12:59:19 +01:00
cmake CMake: Fix gc_sections genex evaluation in pkgconfig file creation 2023-07-16 07:13:24 +00:00
coin Add Axivion analysis commands 2023-05-17 14:04:48 +03:00
config.tests Remove the mandatory x86-64 features from its feature list 2023-05-31 14:55:37 -07:00
dist Add Qt 6.0.0 changes file 2020-11-16 10:02:08 +02:00
doc Introduce macro.qtpolicydeprecatedbehavior for Qt CMake Policy 2023-07-10 19:47:21 +00:00
examples XBEL stream example: use constructor initialization 2023-07-18 07:33:14 +00:00
lib Purge all fonts 2015-08-18 19:59:14 +00:00
libexec Pass native path in qt-internal-configure-tests 2023-04-17 23:32:34 +02:00
LICENSES Clarify license of SHA-1 algorithm 2023-04-26 16:36:18 +02:00
mkspecs wasm: update emscripten to 3.1.37 2023-06-26 07:48:34 +00:00
qmake Doc: Document QMAKE_APPLE_DEVICE_ARCHS 2023-07-10 17:12:21 +00:00
src Check the QTP0002 policy only if paths are set 2023-07-21 15:39:27 +00:00
tests tst_QFuture: fix UB (call of member function on wrong object) 2023-07-22 05:36:59 +00:00
util wasm: add shared library preload scripts 2023-07-03 19:30:37 +00:00
.cmake.conf CMake: Require CMake 3.21 when building/using Qt on Apple platforms 2023-06-28 20:09:30 +00:00
.gitattributes Give batch files CRLF line endings 2020-11-04 15:02:29 +00:00
.gitignore Add CMakeUserPresets.json to .gitignore 2023-06-26 10:29:48 +00:00
.lgtm.yml Skip LGTM analysis for the bootstrap library and tools 2020-07-16 01:04:34 +02:00
.tag Update the git-archive export options 2012-09-07 15:39:31 +02:00
CMakeLists.txt Introduce QT_ALLOW_SYMLINK_IN_PATHS flag 2023-05-03 19:44:45 +02:00
config_help.txt Introduce -no-vcpkg flag for disabling vcpkg detection/integration 2023-06-27 22:00:08 +00:00
configure Retrieve an old -redo behavior 2023-02-07 18:51:58 +00:00
configure.bat Retrieve an old -redo behavior 2023-02-07 18:51:58 +00:00
configure.cmake Update the implementation of -unity-build 2023-06-30 10:54:48 +00:00
dependencies.yaml Re-add dependencies.yaml now that qt5.git wip/qt6 builds fine 2019-09-18 13:19:31 +02:00
qt_cmdline.cmake Update the implementation of -unity-build 2023-06-30 10:54:48 +00:00
sync.profile rhi: Make it a QPA-style private but semi-public API 2023-05-21 15:42:58 +02:00