* Don't crash when upgrading the Berkeley DB environment.

This commit is contained in:
Eelco Dolstra 2006-10-13 11:15:53 +00:00
parent 2a535689fe
commit e4af398681
1 changed files with 6 additions and 1 deletions

View File

@ -30,7 +30,12 @@ class DestroyDbEnv
DbEnv * dbenv;
public:
DestroyDbEnv(DbEnv * _dbenv) : dbenv(_dbenv) { }
~DestroyDbEnv() { if (dbenv) { dbenv->close(0); delete dbenv; } }
~DestroyDbEnv() {
if (dbenv) {
if (dbenv->get_DB_ENV()) dbenv->close(0);
delete dbenv;
}
}
void release() { dbenv = 0; };
};