mdbx: более полная очистка курсоров при закрытии/отключении.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2025-03-02 11:44:10 +03:00
parent fbb93f9cfb
commit 28ca18972a

View File

@ -122,8 +122,8 @@ int mdbx_cursor_unbind(MDBX_cursor *mc) {
} }
mc->next = mc; mc->next = mc;
} }
be_poor(mc);
mc->signature = cur_signature_ready4dispose; mc->signature = cur_signature_ready4dispose;
mc->flags = 0;
return MDBX_SUCCESS; return MDBX_SUCCESS;
} }
@ -172,6 +172,7 @@ void mdbx_cursor_close(MDBX_cursor *mc) {
/* Cursor closed before nested txn ends */ /* Cursor closed before nested txn ends */
tASSERT(txn, mc->signature == cur_signature_live); tASSERT(txn, mc->signature == cur_signature_live);
ENSURE(txn->env, check_txn_rw(txn, 0) == MDBX_SUCCESS); ENSURE(txn->env, check_txn_rw(txn, 0) == MDBX_SUCCESS);
be_poor(mc);
mc->signature = cur_signature_wait4eot; mc->signature = cur_signature_wait4eot;
} }
} }
@ -219,8 +220,8 @@ int mdbx_txn_release_all_cursors(const MDBX_txn *txn, bool unbind) {
txn->cursors[i] = mc->next; txn->cursors[i] = mc->next;
mc->next = mc; mc->next = mc;
if (unbind) { if (unbind) {
be_poor(mc);
mc->signature = cur_signature_ready4dispose; mc->signature = cur_signature_ready4dispose;
mc->flags = 0;
} else { } else {
mc->signature = 0; mc->signature = 0;
osal_free(mc); osal_free(mc);