From 8be3995efaa78a89db28994af620ae8b92fcf9ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Sat, 6 Mar 2021 13:26:16 +0100 Subject: [PATCH] Fix crash on cleanup of EditorFileServer (cherry picked from commit 565796518d27e345c4d53a13048f306a8f2c57a7) --- editor/fileserver/editor_file_server.cpp | 5 +++-- editor/fileserver/editor_file_server.h | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp index 4e723dd1ddf..9de4ec63163 100644 --- a/editor/fileserver/editor_file_server.cpp +++ b/editor/fileserver/editor_file_server.cpp @@ -43,7 +43,7 @@ void EditorFileServer::_close_client(ClientData *cd) { cd->connection->disconnect_from_host(); cd->efs->wait_mutex.lock(); - cd->efs->to_wait.insert(&cd->thread); + cd->efs->to_wait.insert(cd->thread); cd->efs->wait_mutex.unlock(); while (cd->files.size()) { memdelete(cd->files.front()->get()); @@ -291,7 +291,8 @@ void EditorFileServer::_thread_start(void *s) { cd->connection = self->server->take_connection(); cd->efs = self; cd->quit = false; - cd->thread.start(_subthread_start, cd); + cd->thread = memnew(Thread); + cd->thread->start(_subthread_start, cd); } } diff --git a/editor/fileserver/editor_file_server.h b/editor/fileserver/editor_file_server.h index 1ba7803fab9..774eabfdcfd 100644 --- a/editor/fileserver/editor_file_server.h +++ b/editor/fileserver/editor_file_server.h @@ -48,8 +48,7 @@ class EditorFileServer : public Object { }; struct ClientData { - - Thread thread; + Thread *thread; Ref connection; Map files; EditorFileServer *efs;