thread termination hooks on main thread can cause crash

Description

If a thread hook is added whilst on the main thread, then there there is no automatic call to callThreadTerminationHooks.
Instead the hooks are called as part of the module exit scheme.
However, the hooks vector is a thread local variable, which has wound up by the time atexit handling happens, and so accessing vector elements causes a crash.

NB: If ExitModuleObjects() is called at end of main() this avoids the issue.

Fix by spotting hooks added on main thread and track using a separate vector (that is not a thread local).

Conclusion

None

Activity

Show:
Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Components

Assignee

Reporter

Priority

Compatibility

Point

Fix versions

Pull Request URL

Created December 3, 2019 at 12:37 PM
Updated December 6, 2019 at 12:57 PM
Resolved December 6, 2019 at 12:57 PM