In Delphi 2009 I\'m finding that any time I use TThread.CurrentThread in an application, I\'ll get an error message like the following when the application closes:
Unfortunately it seems like a bug linked to the call order of the finalization section in the Classes unit:
DoneThreadSynchronization clears the ThreadLock structure, then
FreeExternalThreads wants to destroy the Thread object you just created when calling CurrentThread, and
that requires the ThreadLock to be already initialized in the call to
EnterCriticalSection(ThreadLock) in TThread.RemoveQueuedEvents...
UPDATE:
There is now a workaround patch in the QC report.