diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-11-18 11:58:32 +0100 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-11-22 19:45:03 +0000 |
commit | 0d989a99d045d692695d6890b37ccb679f03c6ba (patch) | |
tree | d4f552bc6ed3e7e719204b8b43cecfd046089fef /src/db.cpp | |
parent | cb44c07349175514c608a115ec3bf92c23296e19 (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/db.cpp')
-rw-r--r-- | src/db.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/db.cpp b/src/db.cpp index 297240c842..21c3da4cda 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() @@ -65,6 +67,7 @@ bool CDBEnv::Open(boost::filesystem::path pathEnv_) pathEnv = pathEnv_; filesystem::path pathDataDir = pathEnv; + strPath = pathDataDir.string(); filesystem::path pathLogDir = pathDataDir / "database"; filesystem::create_directory(pathLogDir); filesystem::path pathErrorFile = pathDataDir / "db.log"; @@ -85,7 +88,7 @@ bool CDBEnv::Open(boost::filesystem::path pathEnv_) 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(pathDataDir.string().c_str(), + int ret = dbenv.open(strPath.c_str(), DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | |