Merge pull request #955

7442dd0 More for Issue #855 (Howard Chu)
This commit is contained in:
Riccardo Spagni 2016-08-11 22:44:29 +02:00
commit 45f4ef7a6d
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
1 changed files with 12 additions and 6 deletions

View File

@ -6599,8 +6599,14 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data,
if (key->mv_size == 0) if (key->mv_size == 0)
return MDB_BAD_VALSIZE; return MDB_BAD_VALSIZE;
if (mc->mc_xcursor) if (mc->mc_xcursor) {
#ifdef MDB_VL32
if (mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) {
mdb_cursor_unref(&mc->mc_xcursor->mx_cursor);
}
#endif
mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF);
}
/* See if we're already on the right page */ /* See if we're already on the right page */
if (mc->mc_flags & C_INITIALIZED) { if (mc->mc_flags & C_INITIALIZED) {
@ -6732,11 +6738,6 @@ set1:
return MDB_SUCCESS; return MDB_SUCCESS;
} }
#ifdef MDB_VL32
if (mc->mc_xcursor && mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) {
mdb_cursor_unref(&mc->mc_xcursor->mx_cursor);
}
#endif
if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (F_ISSET(leaf->mn_flags, F_DUPDATA)) {
mdb_xcursor_init1(mc, leaf); mdb_xcursor_init1(mc, leaf);
} }
@ -8311,6 +8312,11 @@ mdb_cursor_count(MDB_cursor *mc, mdb_size_t *countp)
void void
mdb_cursor_close(MDB_cursor *mc) mdb_cursor_close(MDB_cursor *mc)
{ {
#ifdef MDB_VL32
if (mc) {
mdb_cursor_unref(mc);
}
#endif
if (mc && !mc->mc_backup) { if (mc && !mc->mc_backup) {
/* remove from txn, if tracked */ /* remove from txn, if tracked */
if ((mc->mc_flags & C_UNTRACK) && mc->mc_txn->mt_cursors) { if ((mc->mc_flags & C_UNTRACK) && mc->mc_txn->mt_cursors) {