Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on exit on Android with destroy_on_exit #974

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

jblazquez
Copy link

When mi_option_destroy_on_exit is set, the call to _mi_heap_unsafe_destroy_all (which calls mi_prim_get_default_heap, which in turn calls pthread_getspecific with _mi_heap_default_key) is made after the call to _mi_prim_thread_done_auto_done (which calls pthread_key_delete with _mi_heap_default_key).

It appears that, at least on Android, calling pthread_getspecific after pthread_key_delete returns a null value, which causes mi_prim_get_default_heap to return the empty heap, and this line to crash due to heap->tld being null.

This change moves the call to _mi_prim_thread_done_auto_done after all of the uses of mi_prim_get_default_heap, so accessing the default heap is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant