Merge pull request #46727 from RandomShaper/fix_nfs_crash

Fix crash on cleanup of EditorFileServer
This commit is contained in:
Rémi Verschelde 2021-03-06 16:11:23 +01:00 committed by GitHub
commit ac249032bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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());
@ -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);
}
}

View File

@ -47,7 +47,7 @@ class EditorFileServer : public Object {
};
struct ClientData {
Thread thread;
Thread *thread;
Ref<StreamPeerTCP> connection;
Map<int, FileAccess *> files;
EditorFileServer *efs = nullptr;