diff options
author | Mikolaj Boc <mikolaj.boc@qt.io> | 2022-12-19 16:41:46 +0100 |
---|---|---|
committer | Mikolaj Boc <mikolaj.boc@qt.io> | 2022-12-22 12:16:02 +0100 |
commit | cc60d70699019030a8cba777de5c46b4f4b8b31a (patch) | |
tree | 0fe3c503c4fe1799acd6e9163166ec380039f114 /src/plugins/platforms/wasm/qwasmdrag.cpp | |
parent | 8420d3e0b205d0ef2367224afd3040c68e28bcc9 (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/plugins/platforms/wasm/qwasmdrag.cpp')
-rw-r--r-- | src/plugins/platforms/wasm/qwasmdrag.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/platforms/wasm/qwasmdrag.cpp b/src/plugins/platforms/wasm/qwasmdrag.cpp index 52c2ddb14e2..0f3aa9c751d 100644 --- a/src/plugins/platforms/wasm/qwasmdrag.cpp +++ b/src/plugins/platforms/wasm/qwasmdrag.cpp @@ -109,9 +109,9 @@ static void dropEvent(val event) QByteArray fileContent; fileContent.resize(file.size()); - file.stream(fileContent.data(), [=]() { + file.stream(fileContent.data(), [mimeFormat, fileContent]() { if (!fileContent.isEmpty()) { - + QWasmDrag *wasmDrag = static_cast<QWasmDrag *>(QWasmIntegration::get()->drag()); if (mimeFormat.contains("image")) { QImage image; image.loadFromData(fileContent, nullptr); @@ -119,7 +119,7 @@ static void dropEvent(val event) } else { wasmDrag->m_mimeData->setData(mimeFormat, fileContent.data()); } - wasmDrag->qWasmDrop(); + wasmDrag->qWasmDrop(); } }); |