Ivan Solovev b0e82f5981 QFutureInterfaceBase: rework setContinuation() overload set
Add new overloads to make sure that we can pass continuation data
even for the continuations with context. The new overloads
intentionally do not expose QFutureInterfaceBasePrivate pointer,
because they would be used in the inline code (see QTBUG-117514).
The overload with a context provides a continuation future as a
QVariant, because that is the easiest way to keep the
QFutureInterface<T> object alive without exposing the template
type T to a non-templated exported base class. We cannot pass the
QFutureInterfaceBase because of the reference count logic, which
contains two different counters: for base class (void case), and
for the interface that holds an actual type T.

This patch is a pre-requisite for a follow-up patch that would
introduce the ability to cancel the entire continuation
chain from the first QFuture object of the chain, even if
that QFuture is already finished.

Note that the pre-existing QFutureInterface::cancel() code
relies on the fact that only then-continuations provide
continuation data. The onFailed() and onCanceled() handlers
never provide it, even when they were supposed to be executed
in the same thread.
To keep the old behavior on the cancel() method, introduce
a new ContinuationType enum and make sure that the type is
properly set when providing a continuation data.

The new overloads also allow to get rid of the template
QtPrivate::watchContinuation() helper method. The exported
Impl should stay for BC reasons. This patch implements it
in terms of the new setContinuation() overload.

During the development of this patch it was important to
verify that the behavior of all public and/or exported
methods stays unchanged. It was done by running the tst_qfuture
binary that was originally compiled with the old QtCore version
against the updated QtCore library.

Task-number: QTBUG-130662
Change-Id: I2bd5821846561d18c198205f3c57d3f0dacbb94b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-02-11 12:19:45 +01:00
2025-01-30 22:32:40 +01:00
2024-11-05 14:36:16 +01:00
2024-11-05 14:36:16 +01:00
2025-01-27 07:47:59 +00:00
2025-02-10 18:36:55 +01:00
2024-12-13 14:54:23 +00:00
2024-06-25 11:44:00 +02:00
Description
Qt Base (Core, Gui, Widgets, Network, ...)
822 MiB
Languages
C++ 84.3%
HTML 4.9%
C 3.9%
CMake 3.6%
Objective-C++ 2%
Other 0.8%