Re: GUI multithreaded Win32 program sometimes freeze when quitting
On 18/04/17 12:00, Dennis wrote:
> I have an win32 multithreaded program written in lazarus 1.7, FPC 3.1.1
> From time to time, when it quits, it will freezes and from the task
> manager, the program will occupies the entire CPU core.
> I noticed that it will happen more often if:
This might be better on the Lazarus ML since it's likely to be a
subtlety of the LCL.
My experience is that it pays to be absolutely paranoid during
termination regarding the continued availability of anything associated
with a form, and also about termination flags themselves particularly
the application terminate flag.
Granted that most of my unhappy experience in this area was in Delphi,
but like yourself I found the culprit elusive.
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
On Tue, Apr 18, 2017 at 07:32:21PM +0800, Dennis wrote:
> Since this freezing behavour does not happen during debugging, I have spent
> months trying to fix it but failed.
> Any suggestions are welcome.
Try using a data race detector to see if it's a deadlock. I don't know
about Windows, but I've used the helgrind tool in valgrind to
successfully fix thread errors in a lazarus program. If you're lucky,
the problem will manifest itself on a platform that valgrind is