Fix crash deleting a never started thread.

Fixes #4069.
Merge pull request #4079 from unknownbrackets/thread-funcs

Fix crash deleting a never started thread w/ clearstack