ITS#7594 Invalidate a dropped MDB DB's cursors.

This commit is contained in:
Hallvard Furuseth 2013-06-13 08:58:24 +02:00
parent 62e4c4f9d0
commit 2bacf6e59e

View File

@ -7450,7 +7450,7 @@ mdb_drop0(MDB_cursor *mc, int subs)
int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del) int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del)
{ {
MDB_cursor *mc; MDB_cursor *mc, *m2;
int rc; int rc;
if (!txn || !dbi || dbi >= txn->mt_numdbs || (unsigned)del > 1 || !(txn->mt_dbflags[dbi] & DB_VALID)) if (!txn || !dbi || dbi >= txn->mt_numdbs || (unsigned)del > 1 || !(txn->mt_dbflags[dbi] & DB_VALID))
@ -7464,6 +7464,9 @@ int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del)
return rc; return rc;
rc = mdb_drop0(mc, mc->mc_db->md_flags & MDB_DUPSORT); rc = mdb_drop0(mc, mc->mc_db->md_flags & MDB_DUPSORT);
/* Invalidate the dropped DB's cursors */
for (m2 = mc->mc_txn->mt_cursors[dbi]; m2; m2 = m2->mc_next)
m2->mc_flags &= ~C_INITIALIZED;
if (rc) if (rc)
goto leave; goto leave;