You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Fix data race regarding server_quit in EditorExportPlatformWeb
This commit is contained in:
@@ -676,7 +676,7 @@ Ref<Texture2D> EditorExportPlatformWeb::get_run_icon() const {
|
|||||||
|
|
||||||
void EditorExportPlatformWeb::_server_thread_poll(void *data) {
|
void EditorExportPlatformWeb::_server_thread_poll(void *data) {
|
||||||
EditorExportPlatformWeb *ej = static_cast<EditorExportPlatformWeb *>(data);
|
EditorExportPlatformWeb *ej = static_cast<EditorExportPlatformWeb *>(data);
|
||||||
while (!ej->server_quit) {
|
while (!ej->server_quit.get()) {
|
||||||
OS::get_singleton()->delay_usec(6900);
|
OS::get_singleton()->delay_usec(6900);
|
||||||
{
|
{
|
||||||
MutexLock lock(ej->server_lock);
|
MutexLock lock(ej->server_lock);
|
||||||
@@ -714,7 +714,7 @@ EditorExportPlatformWeb::~EditorExportPlatformWeb() {
|
|||||||
if (server.is_valid()) {
|
if (server.is_valid()) {
|
||||||
server->stop();
|
server->stop();
|
||||||
}
|
}
|
||||||
server_quit = true;
|
server_quit.set(true);
|
||||||
if (server_thread.is_started()) {
|
if (server_thread.is_started()) {
|
||||||
server_thread.wait_to_finish();
|
server_thread.wait_to_finish();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class EditorExportPlatformWeb : public EditorExportPlatform {
|
|||||||
int menu_options = 0;
|
int menu_options = 0;
|
||||||
|
|
||||||
Ref<EditorHTTPServer> server;
|
Ref<EditorHTTPServer> server;
|
||||||
bool server_quit = false;
|
SafeNumeric<bool> server_quit;
|
||||||
Mutex server_lock;
|
Mutex server_lock;
|
||||||
Thread server_thread;
|
Thread server_thread;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user