mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Don’t close file descriptor until after ~PackedFdMessageReader()
The message reader may use the file descriptor in its destructor, which is why we can’t close it until that object has been destroyed.
This commit is contained in:
@@ -92,7 +92,7 @@ namespace plist
|
||||
int fd = open(path.c_str(), O_RDONLY|O_CLOEXEC);
|
||||
if(fd != -1)
|
||||
{
|
||||
capnp::PackedFdMessageReader message(fd);
|
||||
capnp::PackedFdMessageReader message(kj::AutoCloseFd{fd});
|
||||
for(auto src : message.getRoot<Cache>().getEntries())
|
||||
{
|
||||
entry_t entry(src.getPath().cStr());
|
||||
@@ -150,8 +150,6 @@ namespace plist
|
||||
if(entry.type() != entry_type_t::unknown)
|
||||
_cache.emplace(src.getPath().cStr(), entry);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user