wasm: Dont access QNetworkReply header data through dangling pointer

Fixes: QTBUG-122893
Pick-to: 6.6 6.5
Change-Id: I3768fdffaec7be4ec0b559fdb365600220e648d1
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit a5b00cefef12999e9a213943855abe6bc0ab5365)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Piotr Wierciński 2024-02-29 16:53:07 +01:00 committed by Qt Cherry-pick Bot
parent 4b7e8af859
commit 9a59f6bc57
2 changed files with 2 additions and 2 deletions

View File

@ -53,6 +53,7 @@ public:
void interrupt() override;
void wakeUp() override;
static void runOnMainThread(std::function<void(void)> fn);
static void runOnMainThreadAsync(std::function<void(void)> fn);
static void socketSelect(int timeout, int socket, bool waitForRead, bool waitForWrite,
bool *selectForRead, bool *selectForWrite, bool *socketDisconnect);
@ -89,7 +90,6 @@ private:
bool *selectForRead, bool *selectForWrite, bool *socketDisconnect);
static void run(std::function<void(void)> fn);
static void runOnMainThread(std::function<void(void)> fn);
static void runAsync(std::function<void(void)> fn);
static QEventDispatcherWasm *g_mainThreadEventDispatcher;

View File

@ -297,7 +297,7 @@ void QNetworkReplyWasmImplPrivate::doSendRequest()
attr.destinationPath = destinationPath.constData();
auto url = request.url().toString().toUtf8();
QEventDispatcherWasm::runOnMainThreadAsync([attr, url]() mutable {
QEventDispatcherWasm::runOnMainThread([attr, url]() mutable {
emscripten_fetch(&attr, url);
});
state = Working;