Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-04

GUI multithreaded Win32 program sometimes freeze when quitting

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dennis

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:
1)
constructor TMyComponent.Create(TheOwner : TComponent);
begin
    self.some_component := TSomeComponent.Create(TheOwner);
end;

instead of

constructor TMyComponent.Create(TheOwner : TComponent);
begin
    self.some_component := TSomeComponent.Create(self);
end;

2) if the program executes some methods of a nil object

3) if I don't do a build all when some common units are changed by another project.

Since this freezing behaviour does not happen during debugging, I have spent months trying to fix it but failed.

Any suggestions are welcome.

Dennis

Reply by email

Bart
to Dennis
Dennis wrote 7 lines
I noticed that it will happen more often if: 1) constructor TMyComponent.Create(TheOwner : TComponent); begin self.some_component := TSomeComponent.Create(TheOwner); end;

A bit OT, but would think that is bad practice.

Bart

Reply by email