Skip to content

Commit c9c790e

Browse files
committed
update(HTTP): Execute callback on main thread
1 parent cd9a661 commit c9c790e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/plugins/core/scripting/http.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,11 @@ std::string PluginHTTP::PerformHTTPWithRequestID(std::string receivedData, std::
153153
SteamAPICall_t call;
154154
g_http->SendHTTPRequest(req, &call);
155155
new TrackedRequest(req, call, requestID, [](HTTPRequestHandle hndl, int status, std::string body, std::string headers, std::string err, std::string reqID) -> void {
156-
PluginEvent* event = new PluginEvent("core", nullptr, nullptr);
157-
g_pluginManager->ExecuteEvent("core", "OnHTTPActionPerformed", encoders::msgpack::SerializeToString({ status, body, headers, err, reqID }), event);
158-
delete event;
156+
g_Plugin.NextFrame([&]() -> void {
157+
PluginEvent* event = new PluginEvent("core", nullptr, nullptr);
158+
g_pluginManager->ExecuteEvent("core", "OnHTTPActionPerformed", encoders::msgpack::SerializeToString({ status, body, headers, err, reqID }), event);
159+
delete event;
160+
});
159161
});
160162

161163
return requestID;

0 commit comments

Comments
 (0)