浏览代码

* use the correct thread ID when checking for the main thread
* ensure that the Exception reference is Nil when appending a synchronize entry to the synchronize queue

git-svn-id: trunk@23234 -

svenbarth 12 年之前
父节点
当前提交
70a7a09413
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      rtl/objpas/classes/classes.inc

+ 2 - 1
rtl/objpas/classes/classes.inc

@@ -241,7 +241,7 @@ end;
 procedure ThreadQueueAppend(aEntry: TThread.PThreadQueueEntry);
 procedure ThreadQueueAppend(aEntry: TThread.PThreadQueueEntry);
 begin
 begin
   { do we really need a synchronized call? }
   { do we really need a synchronized call? }
-  if aEntry^.Thread.ThreadID = MainThreadID then begin
+  if GetCurrentThreadID = MainThreadID then begin
     ExecuteThreadQueueEntry(aEntry);
     ExecuteThreadQueueEntry(aEntry);
     if not Assigned(aEntry^.SyncEvent) then
     if not Assigned(aEntry^.SyncEvent) then
       Dispose(aEntry);
       Dispose(aEntry);
@@ -305,6 +305,7 @@ class procedure TThread.Synchronize(AThread: TThread; AMethod: TThreadMethod);
     { the Synchronize event is instantiated on demand }
     { the Synchronize event is instantiated on demand }
     AThread.InitSynchronizeEvent;
     AThread.InitSynchronizeEvent;
 
 
+    AThread.FSynchronizeEntry^.Exception := Nil;
     AThread.FSynchronizeEntry^.Method := AMethod;
     AThread.FSynchronizeEntry^.Method := AMethod;
     ThreadQueueAppend(AThread.FSynchronizeEntry);
     ThreadQueueAppend(AThread.FSynchronizeEntry);