summaryrefslogtreecommitdiffstats
path: root/src/concurrent
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2023-02-17 10:19:14 +0100
committerIvan Solovev <ivan.solovev@qt.io>2023-04-26 19:27:30 +0200
commit5ddb5d1fee52700b71701203ac622b3b363eab46 (patch)
tree6aa629b3519034b36abffa235a795ca6940c3a33 /src/concurrent
parent3abfd4aa7c709202dbbd0d24f3a0cf4f6108fea5 (diff)
Rework imagescaling example to avoid potential crashes
Creating a continuation with QtFuture::Launch::Async policy does not work well with the example, because it still needs to update the UI once the async continuation is finished. If the user decides to close the application while the async continuation is executed, the next continuation will be accessing data from the destroyed Images object. Fix it by using QtConcurrent::run() to do the "heavy" work in a separate thread, and use a QFutureWatcher to handle the results of the async execution. Update the example documentation accordingly. After this patch the example still shows the usage of continuations and onCanceled()/onFailed() handlers. However, it now does not illustrate the usage of different launch policies and continuation contexts. It might not be a big issue, because the QFuture documentation describes these topics rather extensively. Fixes: QTBUG-103514 Pick-to: 6.5 Change-Id: I8142535064ff7a4e8007a5c0a8fe7709d6d942ec Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/concurrent')
-rw-r--r--src/concurrent/doc/qtconcurrent.qdocconf2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf
index 419ca1f801..1669a58b41 100644
--- a/src/concurrent/doc/qtconcurrent.qdocconf
+++ b/src/concurrent/doc/qtconcurrent.qdocconf
@@ -26,7 +26,7 @@ qhp.QtConcurrent.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtconcurrent/qtconcurrent.tags
-depends += qtcore qtdoc qmake qtcmake
+depends += qtcore qtnetwork qtdoc qmake qtcmake
headerdirs += ..