aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-03-26 13:40:24 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-03-26 13:40:24 +0100
commitd9008cf85aa499bdf298a237c60676a9f8c4de14 (patch)
tree67e561787d332aade55a267bfa8fe4a9a3f17188 /src
parentfcce544e8bc6799632df6276fe92758b9eb3aa7b (diff)
downloadPROJ-d9008cf85aa499bdf298a237c60676a9f8c4de14.tar.gz
PROJ-d9008cf85aa499bdf298a237c60676a9f8c4de14.zip
factory.cpp: make closeDB() noexcept so that DatabaseContext::Private destructor cannot throw. Coverity CID 193518
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/factory.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp
index d6517748..e42ed89f 100644
--- a/src/iso19111/factory.cpp
+++ b/src/iso19111/factory.cpp
@@ -259,7 +259,7 @@ struct DatabaseContext::Private {
static void getFromCache(LRUCacheOfObjects &cache, const std::string &code,
util::BaseObjectPtr &obj);
- void closeDB();
+ void closeDB() noexcept;
// cppcheck-suppress functionStatic
void registerFunctions();
@@ -295,7 +295,7 @@ DatabaseContext::Private::~Private() {
// ---------------------------------------------------------------------------
-void DatabaseContext::Private::closeDB() {
+void DatabaseContext::Private::closeDB() noexcept {
if (detach_) {
// Workaround a bug visible in SQLite 3.8.1 and 3.8.2 that causes
@@ -309,7 +309,10 @@ void DatabaseContext::Private::closeDB() {
// https://github.com/mackyle/sqlite/commit/ccf328c4318eacedab9ed08c404bc4f402dcad19
// also seemed to hide the issue.
// Detaching a database hides the issue, not sure if it is by chance...
- run("DETACH DATABASE db_0");
+ try {
+ run("DETACH DATABASE db_0");
+ } catch (...) {
+ }
detach_ = false;
}