Delphi 7 Occasional deadlock changing TLabel.Font.Style from IdHTTPListener event

牧云@^-^@ 提交于 2019-12-02 10:05:23
Arioch 'The

You cannot manipulate UI controls from worker threads, only from the main GUI thread!

You have two options:

You may block your HTTP threads and temporary switch to main thread by TThread.Synchronize() procedure. Like in this example:

http://docwiki.embarcadero.com/CodeExamples/Seattle/en/Synchronize_(Delphi)

You may prefer delayed out-of-sync execution via

First option might slow you down, for any long processing in the GUI thread would also freeze your HTTP handlers.

Second options would require making a "snapshot" copy of any required data and passing it along with the deferred call request ( as the VCL update code might be executed at any random time AFTER (or during) the HTTP handler (or several HTTP handlers). It would be normal when several HTTP handlers would request GUI updates and you would have to check which of them passed the most recent data and skip other requests for example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!