Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Sources/SQLite/Core/Connection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,14 @@ public final class Connection {
}

deinit {
try? close()
guard let handle = _handle else {
return
}
// Note: sqlite3_close_v2 differs from sqlite3_close. While sqlite3_close fails with
// SQLITE_BUSY if unfinalized prepared statements exist, sqlite3_close_v2 marks
// the connection as a zombie and defers final cleanup until all statements are finalized,
// preventing crashes or resource leaks when Connection is deallocated.
sqlite3_close_v2(handle)
Comment thread
vjymisal0 marked this conversation as resolved.
}

// MARK: -
Expand Down
Loading