switchbrew / libnx

Library for Switch Homebrew
https://switchbrew.github.io/libnx/
ISC License
1.26k stars 167 forks source link

Fix: avoid segfault at static destructors #638

Closed ThisALV closed 9 months ago

ThisALV commented 9 months ago

The exit routine executed after main returned already calls libc_fini_array. Calling it again within __libnx_exit calls the destructor for static objects a second time which results in a segfault when static/global objects are used in a program.