diff options
Diffstat (limited to 'editor/fileserver')
-rw-r--r-- | editor/fileserver/editor_file_server.cpp | 6 | ||||
-rw-r--r-- | editor/fileserver/editor_file_server.h | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp index 30dc9180e3..46fb767c00 100644 --- a/editor/fileserver/editor_file_server.cpp +++ b/editor/fileserver/editor_file_server.cpp @@ -46,7 +46,6 @@ void EditorFileServer::_close_client(ClientData *cd) { cd->efs->to_wait.insert(cd->thread); } while (cd->files.size()) { - memdelete(cd->files.front()->get()); cd->files.erase(cd->files.front()); } memdelete(cd); @@ -181,8 +180,8 @@ void EditorFileServer::_subthread_start(void *s) { break; } - FileAccess *fa = FileAccess::open(s2, FileAccess::READ); - if (!fa) { + Ref<FileAccess> fa = FileAccess::open(s2, FileAccess::READ); + if (fa.is_null()) { //not found, continue encode_uint32(id, buf4); cd->connection->put_data(buf4, 4); @@ -249,7 +248,6 @@ void EditorFileServer::_subthread_start(void *s) { case FileAccessNetwork::COMMAND_CLOSE: { print_verbose("CLOSED"); ERR_CONTINUE(!cd->files.has(id)); - memdelete(cd->files[id]); cd->files.erase(id); } break; } diff --git a/editor/fileserver/editor_file_server.h b/editor/fileserver/editor_file_server.h index a1bb7ecf4e..ccebd1465d 100644 --- a/editor/fileserver/editor_file_server.h +++ b/editor/fileserver/editor_file_server.h @@ -49,7 +49,7 @@ class EditorFileServer : public Object { struct ClientData { Thread *thread = nullptr; Ref<StreamPeerTCP> connection; - Map<int, FileAccess *> files; + Map<int, Ref<FileAccess>> files; EditorFileServer *efs = nullptr; bool quit = false; }; |