summaryrefslogtreecommitdiffstats
path: root/src/gui/platform/wasm
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-12-19 16:41:46 +0100
committerMikolaj Boc <mikolaj.boc@qt.io>2022-12-22 12:16:02 +0100
commitcc60d70699019030a8cba777de5c46b4f4b8b31a (patch)
tree0fe3c503c4fe1799acd6e9163166ec380039f114 /src/gui/platform/wasm
parent8420d3e0b205d0ef2367224afd3040c68e28bcc9 (diff)
Avoid mutual ownership in qstdweb's File::stream
The mutual ownership of chunkCompleted<->fileReader caused both not to be freed, which resulted in a memory leak. Resolve this by introducing the ChunkedFileReader class which owns itself until file read is finished. Also, resolve a similar issue in qwasmlocalfileaccess. Fixes: QTBUG-109436 Pick-to: 6.5 Change-Id: Ieec4cde15a893fa6a2e21a62d3bb6637374c5364 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/gui/platform/wasm')
-rw-r--r--src/gui/platform/wasm/qwasmlocalfileaccess.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/platform/wasm/qwasmlocalfileaccess.cpp b/src/gui/platform/wasm/qwasmlocalfileaccess.cpp
index 1b797be9fe..47deb0d553 100644
--- a/src/gui/platform/wasm/qwasmlocalfileaccess.cpp
+++ b/src/gui/platform/wasm/qwasmlocalfileaccess.cpp
@@ -124,7 +124,7 @@ void readFiles(const qstdweb::FileList &fileList,
}
// Read file data into caller-provided buffer
- file.stream(buffer, [=]() {
+ file.stream(buffer, [readFile = readFile.get(), fileIndex, fileDataReady]() {
fileDataReady();
(*readFile)(fileIndex + 1);
});