Skip to content

Commit

Permalink
Fix crash on cleanup of EditorFileServer
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomShaper committed Mar 6, 2021
1 parent 17e6638 commit 5657965
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions editor/fileserver/editor_file_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void EditorFileServer::_close_client(ClientData *cd) {
cd->connection->disconnect_from_host();
{
MutexLock lock(cd->efs->wait_mutex);
cd->efs->to_wait.insert(&cd->thread);
cd->efs->to_wait.insert(cd->thread);
}
while (cd->files.size()) {
memdelete(cd->files.front()->get());
Expand Down Expand Up @@ -278,7 +278,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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion editor/fileserver/editor_file_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class EditorFileServer : public Object {
};

struct ClientData {
Thread thread;
Thread *thread;
Ref<StreamPeerTCP> connection;
Map<int, FileAccess *> files;
EditorFileServer *efs = nullptr;
Expand Down

0 comments on commit 5657965

Please sign in to comment.