diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-11-18 11:58:32 +0100 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-11-18 14:10:26 +0100 |
commit | be8e1f8479ff46c99f97ac3e396736d36e5458c6 (patch) | |
tree | a300ef46ace1eeab970fe56b3976ced4e39f1a82 /src | |
parent | 4725e96a3aaa4dd602bd356390d190c6777c3a60 (diff) |
Bitcoin-Qt: fix crash on Windows caused by CDBEnv::EnvShutdown()
- can be triggerd by just adding -proxy=crashme with 0.7.1
- crash occured, when AppInit2() was left with return false; after the
first call to bitdb.open() (Step 6 in init)
- this is caused by GetDataDir() or .string() in CDBEnv::EnvShutdown()
called via the bitdb global destructor
- init fDbEnvInit and fMockDb to false in CDBEnv::CDBEnv()
Diffstat (limited to 'src')
-rw-r--r-- | src/db.cpp | 7 | ||||
-rw-r--r-- | src/db.h | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/db.cpp b/src/db.cpp index 60e1f6f280..94629f3cad 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -38,11 +38,13 @@ void CDBEnv::EnvShutdown() if (ret != 0) printf("EnvShutdown exception: %s (%d)\n", DbEnv::strerror(ret), ret); if (!fMockDb) - DbEnv(0).remove(GetDataDir().string().c_str(), 0); + DbEnv(0).remove(strPath.c_str(), 0); } CDBEnv::CDBEnv() : dbenv(DB_CXX_NO_EXCEPTIONS) { + fDbEnvInit = false; + fMockDb = false; } CDBEnv::~CDBEnv() @@ -63,6 +65,7 @@ bool CDBEnv::Open(const boost::filesystem::path& path) if (fShutdown) return false; + strPath = path.string(); filesystem::path pathLogDir = path / "database"; filesystem::create_directory(pathLogDir); filesystem::path pathErrorFile = path / "db.log"; @@ -83,7 +86,7 @@ bool CDBEnv::Open(const boost::filesystem::path& path) dbenv.set_flags(DB_AUTO_COMMIT, 1); dbenv.set_flags(DB_TXN_WRITE_NOSYNC, 1); dbenv.log_set_config(DB_LOG_AUTO_REMOVE, 1); - int ret = dbenv.open(path.string().c_str(), + int ret = dbenv.open(strPath.c_str(), DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | @@ -33,6 +33,7 @@ class CDBEnv private: bool fDbEnvInit; bool fMockDb; + std::string strPath; void EnvShutdown(); |