فهرست منبع

* don't destroy fsem in tthread.destroy before its potential last use

git-svn-id: trunk@5678 -
Jonas Maebe 19 سال پیش
والد
کامیت
cf4b3f2e4d
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      rtl/unix/tthread.inc

+ 2 - 1
rtl/unix/tthread.inc

@@ -162,10 +162,10 @@ begin
       inherited destroy;
       inherited destroy;
       exit;
       exit;
     end;
     end;
-  CurrentTM.SemaphoreDestroy(FSem);
   if (FHandle = TThreadID(0)) then
   if (FHandle = TThreadID(0)) then
   { another exception in constructor }
   { another exception in constructor }
     begin
     begin
+      CurrentTM.SemaphoreDestroy(FSem);
       inherited destroy;
       inherited destroy;
       exit;
       exit;
     end;
     end;
@@ -181,6 +181,7 @@ begin
         Resume;
         Resume;
       WaitFor;
       WaitFor;
     end;
     end;
+  CurrentTM.SemaphoreDestroy(FSem);
   FFatalException.Free;
   FFatalException.Free;
   FFatalException := nil;
   FFatalException := nil;
   { threadvars have been released by cthreads.ThreadMain -> DoneThread }
   { threadvars have been released by cthreads.ThreadMain -> DoneThread }