diff options
author | Dwight <dmerriman@gmail.com> | 2009-12-04 12:50:53 -0500 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2009-12-04 12:50:53 -0500 |
commit | edfa5eca0180eba6fa3086e588b3a268a80c0126 (patch) | |
tree | da69fd8dcec04c4d40a1b98067dfaa225b77ceee /db/instance.h | |
parent | 8968ae7be48e05f625356abb49ca1a2434b853ae (diff) | |
download | mongo-edfa5eca0180eba6fa3086e588b3a268a80c0126.tar.gz |
wrap dbtests with a big dblcok - now passes
Diffstat (limited to 'db/instance.h')
-rw-r--r-- | db/instance.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/db/instance.h b/db/instance.h index fdd572730ae..83d016ad560 100644 --- a/db/instance.h +++ b/db/instance.h @@ -139,6 +139,14 @@ namespace mongo { SavedContext() { Client *c = currentClient.get(); if ( c->database() ) { + /* note you must already be locked here or the database pointer could + be garbage as the db may have been dropped. there are definitely places + in the code where we are done with a db post setClient() and usage + and left the pointer set. if you called SavedContext thereafter unlocked, + that is unsafe, although the code was doing it for a long time. + Thus this assert is required. Ideally context would be nulled out when + done so we never have this problem. + */ dbMutex.assertAtLeastReadLocked(); _oldName = c->database()->name; } |