diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-15 17:38:50 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-15 21:47:20 +0200 |
commit | c668f5acda86b8c2d42cb03f4eceaa509cd9c0a3 (patch) | |
tree | b2ddedfe59a404188899716d703f6fb63742e379 /common | |
parent | 2e35beec9303c3e9d91526f342229a096a1087d7 (diff) | |
download | sink-c668f5acda86b8c2d42cb03f4eceaa509cd9c0a3.tar.gz sink-c668f5acda86b8c2d42cb03f4eceaa509cd9c0a3.zip |
Try a bit harder to ensure that env always has a sane value.
Diffstat (limited to 'common')
-rw-r--r-- | common/storage_lmdb.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index 227d52e..a8c5cc7 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp | |||
@@ -562,6 +562,7 @@ public: | |||
562 | { | 562 | { |
563 | Q_ASSERT(!transaction); | 563 | Q_ASSERT(!transaction); |
564 | Q_ASSERT(sEnvironments.values().contains(env)); | 564 | Q_ASSERT(sEnvironments.values().contains(env)); |
565 | Q_ASSERT(env); | ||
565 | // auto f = [](const char *msg, void *ctx) -> int { | 566 | // auto f = [](const char *msg, void *ctx) -> int { |
566 | // qDebug() << msg; | 567 | // qDebug() << msg; |
567 | // return 0; | 568 | // return 0; |
@@ -816,7 +817,7 @@ public: | |||
816 | QString storageRoot; | 817 | QString storageRoot; |
817 | QString name; | 818 | QString name; |
818 | 819 | ||
819 | MDB_env *env; | 820 | MDB_env *env = nullptr; |
820 | AccessMode mode; | 821 | AccessMode mode; |
821 | Sink::Log::Context logCtx; | 822 | Sink::Log::Context logCtx; |
822 | 823 | ||
@@ -833,6 +834,7 @@ public: | |||
833 | if ((rc = mdb_env_create(&env))) { | 834 | if ((rc = mdb_env_create(&env))) { |
834 | SinkWarningCtx(logCtx) << "mdb_env_create: " << rc << " " << mdb_strerror(rc); | 835 | SinkWarningCtx(logCtx) << "mdb_env_create: " << rc << " " << mdb_strerror(rc); |
835 | qCritical() << "mdb_env_create: " << rc << " " << mdb_strerror(rc); | 836 | qCritical() << "mdb_env_create: " << rc << " " << mdb_strerror(rc); |
837 | env = nullptr; | ||
836 | } else { | 838 | } else { |
837 | //Limit large enough to accomodate all our named dbs. This only starts to matter if the number gets large, otherwise it's just a bunch of extra entries in the main table. | 839 | //Limit large enough to accomodate all our named dbs. This only starts to matter if the number gets large, otherwise it's just a bunch of extra entries in the main table. |
838 | mdb_env_set_maxdbs(env, 50); | 840 | mdb_env_set_maxdbs(env, 50); |