Browse Source

+ Test for Mantis #17560

git-svn-id: trunk@16291 -
sergei 14 years ago
parent
commit
d8eccf008d
2 changed files with 29 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 28 0
      tests/webtbs/tw17560.pp

+ 1 - 0
.gitattributes

@@ -10720,6 +10720,7 @@ tests/webtbs/tw17546.pp svneol=native#text/plain
 tests/webtbs/tw1754c.pp svneol=native#text/plain
 tests/webtbs/tw1755.pp svneol=native#text/plain
 tests/webtbs/tw17550.pp svneol=native#text/plain
+tests/webtbs/tw17560.pp svneol=native#text/plain
 tests/webtbs/tw1758.pp svneol=native#text/plain
 tests/webtbs/tw17604.pp svneol=native#text/plain
 tests/webtbs/tw17646.pp svneol=native#text/plain

+ 28 - 0
tests/webtbs/tw17560.pp

@@ -0,0 +1,28 @@
+{ %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 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.