* Close the database before the destructor runs.
This commit is contained in:
parent
fa95f4be3f
commit
d822bf32e4
|
@ -14,6 +14,7 @@ extern "C" {
|
|||
|
||||
#include "globals.hh"
|
||||
#include "gc.hh"
|
||||
#include "store.hh"
|
||||
#include "shared.hh"
|
||||
|
||||
#include "config.h"
|
||||
|
@ -213,6 +214,8 @@ static void initAndRun(int argc, char * * argv)
|
|||
RemoveTempRoots removeTempRoots; /* unused variable - don't remove */
|
||||
|
||||
run(remaining);
|
||||
|
||||
closeDB(); /* it's fine if the DB isn't actually open */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -278,6 +278,8 @@ void Database::close()
|
|||
} catch (DbException e) { rethrow(e); }
|
||||
|
||||
delete env;
|
||||
|
||||
env = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -136,6 +136,13 @@ void initDB()
|
|||
}
|
||||
|
||||
|
||||
void closeDB()
|
||||
{
|
||||
/* If the database isn't open, this is a NOP. */
|
||||
nixDB.close();
|
||||
}
|
||||
|
||||
|
||||
void createStoreTransaction(Transaction & txn)
|
||||
{
|
||||
Transaction txn2(nixDB);
|
||||
|
|
|
@ -49,6 +49,9 @@ void openDB(bool reserveSpace = true);
|
|||
/* Create the required database tables. */
|
||||
void initDB();
|
||||
|
||||
/* Close the database. */
|
||||
void closeDB();
|
||||
|
||||
/* Get a transaction object. */
|
||||
void createStoreTransaction(Transaction & txn);
|
||||
|
||||
|
|
Loading…
Reference in a new issue