wasm: Dont access QNetworkReply header data through dangling pointer

Fixes: QTBUG-122893
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>
(cherry picked from commit 9a59f6bc574e3b9dfa09ac33e6dd951f105f87bb)
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit 8341bfd960a09576f95ebabb1e9ad767e85198b1)
This commit is contained in:
Piotr Wierciński 2024-02-29 16:53:07 +01:00
parent 2287723ed3
commit afdec88505
2 changed files with 2 additions and 2 deletions

View File

@ -52,6 +52,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:
static void run(std::function<void(void)> fn);
static void runAsync(std::function<void(void)> fn);
static void runOnMainThread(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;