diff options
Diffstat (limited to 'editor/fileserver/editor_file_server.cpp')
-rw-r--r-- | editor/fileserver/editor_file_server.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp index af7eb0c4c7..fb44c145b2 100644 --- a/editor/fileserver/editor_file_server.cpp +++ b/editor/fileserver/editor_file_server.cpp @@ -42,9 +42,10 @@ 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->wait_mutex->unlock(); + { + MutexLock lock(cd->efs->wait_mutex); + cd->efs->to_wait.insert(cd->thread); + } while (cd->files.size()) { memdelete(cd->files.front()->get()); cd->files.erase(cd->files.front()); @@ -295,16 +296,16 @@ void EditorFileServer::_thread_start(void *s) { } } - self->wait_mutex->lock(); + self->wait_mutex.lock(); while (self->to_wait.size()) { Thread *w = self->to_wait.front()->get(); self->to_wait.erase(w); - self->wait_mutex->unlock(); + self->wait_mutex.unlock(); Thread::wait_to_finish(w); memdelete(w); - self->wait_mutex->lock(); + self->wait_mutex.lock(); } - self->wait_mutex->unlock(); + self->wait_mutex.unlock(); OS::get_singleton()->delay_usec(100000); } @@ -331,7 +332,6 @@ void EditorFileServer::stop() { EditorFileServer::EditorFileServer() { server.instance(); - wait_mutex = Mutex::create(); quit = false; active = false; cmd = CMD_NONE; @@ -346,5 +346,4 @@ EditorFileServer::~EditorFileServer() { quit = true; Thread::wait_to_finish(thread); memdelete(thread); - memdelete(wait_mutex); } |