Issue #27787: Clean up weak references before checking for dangling threads
2 files changed