Skip to content
Snippets Groups Projects
Commit 05751e6c authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

box: call tuple_free from box_free

There are four problems we have to address to make this possible:

 1. memtx_engine_shutdown may delete the tuple referenced by
    box_tuple_last so that tuple_free, which is called later by
    box_free, will crash trying to free it. Fix this by clearing
    box_tuple_last in memtx_engine_shutdown.

 2. tuple_format_destroy and tuple_field_delete, called by it, expect
    all constraints to be detached. Let's destroy the constraints if
    this isn't the case. This effectively reverts commit 7a87b9a5
    ("box: do not call constraint[i].destroy() in
    tuple_field_delete()").

 3. tuple_field_delete, called by tuple_format_destroy, expects the
    default value function to be unpinned. Let's unpin it if this isn't
    the case. To avoid linking dependencies between the tuple and box
    libraries, we have to introduce a virtual destructor for
    field_default_func.

 4. The tuple_format unit test calls tuple_free after box_free. If
    box_free calls tuple_free by itself, this leads to a crash. Fix this
    by removing tuple_free and tuple_init calls from the test.

Closes #9174

NO_DOC=code health
NO_CHANGELOG=code health
NO_TEST=checked by existing tests
parent 0ea1ba87
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment