Delphi TThread.CurrentThread and EAccessViolation - Is This a Bug or My Incompetence..?

后端 未结 4 2097
迷失自我
迷失自我 2021-02-20 05:13

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:



        
4条回答
  •  忘了有多久
    2021-02-20 05:48

    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.

提交回复
热议问题