From: Howard Chu Date: Mon, 23 Nov 2015 01:13:16 +0000 (+0000) Subject: ITS#8321 fix mdb_cursor_shadow() X-Git-Tag: LMDB_0.9.17~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=94831f7c3f0f49b6795c34ef71901b5cd5cf6e28;p=openldap ITS#8321 fix mdb_cursor_shadow() Set a valid txn so that cursor fixup code works on the shadows --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index a4d2aad57a..bf3b4ba0ab 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -2489,14 +2489,15 @@ mdb_cursor_shadow(MDB_txn *src, MDB_txn *dst) *bk = *mc; mc->mc_backup = bk; mc->mc_db = &dst->mt_dbs[i]; - /* Kill pointers into src - and dst to reduce abuse: The - * user may not use mc until dst ends. Otherwise we'd... + /* Kill pointers into src to reduce abuse: The + * user may not use mc until dst ends. But we need a valid + * txn pointer here for cursor fixups to keep working. */ - mc->mc_txn = NULL; /* ...set this to dst */ - mc->mc_dbflag = NULL; /* ...and &dst->mt_dbflags[i] */ + mc->mc_txn = dst; + mc->mc_dbflag = &dst->mt_dbflags[i]; if ((mx = mc->mc_xcursor) != NULL) { *(MDB_xcursor *)(bk+1) = *mx; - mx->mx_cursor.mc_txn = NULL; /* ...and dst. */ + mx->mx_cursor.mc_txn = dst; } mc->mc_next = dst->mt_cursors[i]; dst->mt_cursors[i] = mc;