From 0c2dd5e141b35ccd071ed91047f3a5c816364651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Wed, 18 Sep 2024 10:48:53 +0200 Subject: [PATCH] wasm: fix drop of small files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On drop, close the file after write before sending the drop event to make sure file content is flushed to to the file system. Task-number: QTBUG-128855 Change-Id: Ide14bfebbdef07eee03ae1bd19d394da537ab123 Reviewed-by: Piotr WierciƄski (cherry picked from commit 0a37f038bfd7e18d9538dde8212a6c323eb4e70f) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 77aa6640fea9458e11495c947e09aca033f4c6e5) --- src/plugins/platforms/wasm/qwasmdom.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wasm/qwasmdom.cpp b/src/plugins/platforms/wasm/qwasmdom.cpp index 96790ca71f3..b6f6be898ec 100644 --- a/src/plugins/platforms/wasm/qwasmdom.cpp +++ b/src/plugins/platforms/wasm/qwasmdom.cpp @@ -181,10 +181,9 @@ void DataTransfer::toMimeDataWithFile(std::function callback) mimeContext->deref(); return; } - if (file.write(fileContent) < 0) { + if (file.write(fileContent) < 0) qWarning() << "Write failed"; - file.close(); - } + file.close(); mimeContext->deref(); }); break;