Skip to content

Commit 2026dcc

Browse files
authored
Navigator: close the LMDB.Environment on finalize(_:_:_:) (#646)
Ensure that we close the LMDB environment on the exit from `finalize(_:_:_:)` method. This is important for platforms which do not permit alteration of directories with open references. Having the environment be closed after finalization enables the generated index to be moved into the final destination on Windows.
1 parent f71b0f0 commit 2026dcc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/SwiftDocC/Indexing/Navigator/NavigatorIndex.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,9 @@ extension NavigatorIndex {
10971097
return
10981098
}
10991099
}
1100-
1100+
1101+
defer { environment.close() }
1102+
11011103
let database: LMDB.Database
11021104
if let alreadyDefinedDatabase = navigatorIndex.database {
11031105
database = alreadyDefinedDatabase

0 commit comments

Comments
 (0)