The crash happens only when calling eglReleaseThread() from destructor of the process. Please find the attached simple app which can be used to repro the issue.
With valgrind, I see there is some invalid memory access during the eglReleaseThread() call. Find the logs below:
==5059== Invalid read of size 8
==5059== at 0x70480EC: eglReleaseThread (eglapi.c:1706)
==5059== by 0x48825B7: eglReleaseThread (in /usr/lib/aarch64-linux-gnu/libEGL.so.1.1.0)
==5059== by 0x1089FB: deinit (in /home/ubuntu/egl_sample/egl_sample)
==5059== by 0x400EBFF: _dl_fini (dl-fini.c:138)
==5059== by 0x48DC84B: __run_exit_handlers (exit.c:108)
==5059== by 0x48DC9DB: exit (exit.c:139)
==5059== by 0x48C7093: (below main) (libc-start.c:342)
==5059== Address 0x4c6f8c8 is 8 bytes inside a block of size 48 free'd
==5059== at 0x484AF20: free (in /usr/lib/aarch64-linux-gnu/valgrind/vgpreload_memcheck-arm64-linux.so)
==5059== by 0x7051FE3: _eglDestroyThreadInfo (eglcurrent.c:134)
==5059== by 0x7051FE3: _eglFiniTSD (eglcurrent.c:76)
==5059== by 0x70539CF: _eglAtExit (eglglobals.c:112)
==5059== by 0x48DC84B: __run_exit_handlers (exit.c:108)
==5059== by 0x48DC9DB: exit (exit.c:139)
==5059== by 0x48C7093: (below main) (libc-start.c:342)
So eglReleaseThread() in this case, tries to access the _EGLThreadInfo memory already freed by _eglFiniTSD() ? But it is expected that a new instance of _EGLThreadInfo has to be created when eglReleaseThread() is called from the app in this case.
The crash happens only when calling eglReleaseThread() from destructor of the process. Please find the attached simple app which can be used to repro the issue.
With valgrind, I see there is some invalid memory access during the eglReleaseThread() call. Find the logs below:
==5059== Invalid read of size 8 aarch64- linux-gnu/ libEGL. so.1.1. 0) egl_sample/ egl_sample) aarch64- linux-gnu/ valgrind/ vgpreload_ memcheck- arm64-linux. so) adInfo (eglcurrent.c:134)
==5059== at 0x70480EC: eglReleaseThread (eglapi.c:1706)
==5059== by 0x48825B7: eglReleaseThread (in /usr/lib/
==5059== by 0x1089FB: deinit (in /home/ubuntu/
==5059== by 0x400EBFF: _dl_fini (dl-fini.c:138)
==5059== by 0x48DC84B: __run_exit_handlers (exit.c:108)
==5059== by 0x48DC9DB: exit (exit.c:139)
==5059== by 0x48C7093: (below main) (libc-start.c:342)
==5059== Address 0x4c6f8c8 is 8 bytes inside a block of size 48 free'd
==5059== at 0x484AF20: free (in /usr/lib/
==5059== by 0x7051FE3: _eglDestroyThre
==5059== by 0x7051FE3: _eglFiniTSD (eglcurrent.c:76)
==5059== by 0x70539CF: _eglAtExit (eglglobals.c:112)
==5059== by 0x48DC84B: __run_exit_handlers (exit.c:108)
==5059== by 0x48DC9DB: exit (exit.c:139)
==5059== by 0x48C7093: (below main) (libc-start.c:342)
So eglReleaseThread() in this case, tries to access the _EGLThreadInfo memory already freed by _eglFiniTSD() ? But it is expected that a new instance of _EGLThreadInfo has to be created when eglReleaseThread() is called from the app in this case.