Index: sql/mojo/mojo_vfs.cc |
diff --git a/sql/mojo/mojo_vfs.cc b/sql/mojo/mojo_vfs.cc |
index 111bd62c5c83e0033b2359dd8bf7ba7cab695ed2..8fc6da73b837a40e8d50a8324dbba70d5f86238e 100644 |
--- a/sql/mojo/mojo_vfs.cc |
+++ b/sql/mojo/mojo_vfs.cc |
@@ -61,6 +61,11 @@ filesystem::FilePtr& GetFSFile(sqlite3_file* vfs_file) { |
int MojoVFSClose(sqlite3_file* file) { |
DVLOG(1) << "MojoVFSClose(*)"; |
using filesystem::FilePtr; |
+ filesystem::FileError error = filesystem::FILE_ERROR_FAILED; |
+ // Must call File::Close explicitly instead of just deleting the file, since |
+ // otherwise we wouldn't have an object to wait on. |
+ GetFSFile(file)->Close(mojo::Capture(&error)); |
+ GetFSFile(file).WaitForIncomingResponse(); |
GetFSFile(file).~FilePtr(); |
return SQLITE_OK; |
} |