diff --git a/CHANGELOG.md b/CHANGELOG.md index a03ffadf..1a3ddae9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -310,7 +310,8 @@ Version 3.4.0 - 2026 ??? - Restore the Coverity Scan static analysis as a GitHub Actions workflow, replacing the old Travis CI job - Fix Database::getHeaderInfo() signed-shift UB and use fixed-width types for the Header struct (#558) - Restore SQLite::Header 3.x ABI compatibility while keeping fixed-width header parsing (#575) -- Fix Savepoint destructor to catch all exceptions and track rollback state to avoid std::terminate (#559) +- Fix Savepoint destructor to catch all exceptions to avoid std::terminate (#559) +- Restore SQLite::Savepoint 3.x ABI compatibility while retaining destructor exception safety (#576) - Fix Transaction destructor to catch all exceptions to avoid std::terminate (#559) - Fix the Meson build when the SQLITECPP_DISABLE_STD_FILESYSTEM option is enabled (#560) - Add Statement::RowIterator to support range-based for loops over query results (#181) diff --git a/include/SQLiteCpp/Savepoint.h b/include/SQLiteCpp/Savepoint.h index f0b67701..180f8ac4 100644 --- a/include/SQLiteCpp/Savepoint.h +++ b/include/SQLiteCpp/Savepoint.h @@ -90,10 +90,9 @@ class SQLITECPP_API Savepoint void rollback() { rollbackTo(); } private: - Database& mDatabase; ///< Reference to the SQLite Database Connection - std::string msName; ///< Name of the Savepoint - bool mbReleased = false; ///< True when release has been called - bool mbRolledBack = false; ///< True when a rollback to the savepoint has been done + Database& mDatabase; ///< Reference to the SQLite Database Connection + std::string msName; ///< Name of the Savepoint + bool mbReleased = false; ///< True when release has been called }; } // namespace SQLite diff --git a/src/Savepoint.cpp b/src/Savepoint.cpp index b0fa9e76..1b87ee86 100644 --- a/src/Savepoint.cpp +++ b/src/Savepoint.cpp @@ -40,10 +40,7 @@ Savepoint::~Savepoint() { try { - if (!mbRolledBack) - { - rollbackTo(); - } + rollbackTo(); release(); } catch (...) @@ -74,7 +71,6 @@ void Savepoint::rollbackTo() if (!mbReleased) { mDatabase.exec(std::string("ROLLBACK TO SAVEPOINT ") + msName); - mbRolledBack = true; } else {