blob: 597107456c23d960eeaa035ec7c7791314546311 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
{ %OPT=-gh }
// Creating a suspended TThread and then destroying it should not cause memory leaks.
// Also, Execute() method should not be called.
{$ifdef fpc}{$mode objfpc}{$endif}
uses
{$ifdef unix}
cthreads,
{$endif}
SysUtils, Classes;
type
TMyThread = class(TThread)
procedure Execute; override;
end;
var
t: TThread;
Flag: Boolean;
procedure TMyThread.Execute;
begin
flag := True;
end;
begin
Flag := False;
t := TMyThread.Create(True);
t.Free;
Halt(ord(Flag));
end.
|