mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 13:50:29 +02:00
* patch by Rika: fix incorrect exception handling if an exception raised in TThread decendant class's constructor, resolves #40677
This commit is contained in:
parent
c3b8b51cb5
commit
7c95ff434b
@ -265,6 +265,7 @@ begin
|
|||||||
inherited Create;
|
inherited Create;
|
||||||
{$ifdef FPC_HAS_FEATURE_THREADING}
|
{$ifdef FPC_HAS_FEATURE_THREADING}
|
||||||
InterlockedIncrement(ThreadQueueLockCounter);
|
InterlockedIncrement(ThreadQueueLockCounter);
|
||||||
|
FThreadQueueLockCounted := true; { Guard against exception in descendant’s Create. }
|
||||||
{$endif}
|
{$endif}
|
||||||
if FExternalThread then
|
if FExternalThread then
|
||||||
{$ifdef FPC_HAS_FEATURE_THREADING}
|
{$ifdef FPC_HAS_FEATURE_THREADING}
|
||||||
@ -289,7 +290,7 @@ begin
|
|||||||
RemoveQueuedEvents(Self);
|
RemoveQueuedEvents(Self);
|
||||||
DoneSynchronizeEvent;
|
DoneSynchronizeEvent;
|
||||||
{$ifdef FPC_HAS_FEATURE_THREADING}
|
{$ifdef FPC_HAS_FEATURE_THREADING}
|
||||||
if InterlockedDecrement(ThreadQueueLockCounter)=0 then
|
if FThreadQueueLockCounted and (InterlockedDecrement(ThreadQueueLockCounter)=0) then
|
||||||
DoneCriticalSection(ThreadQueueLock);
|
DoneCriticalSection(ThreadQueueLock);
|
||||||
{$endif}
|
{$endif}
|
||||||
{ set CurrentThreadVar to Nil? }
|
{ set CurrentThreadVar to Nil? }
|
||||||
|
@ -2230,7 +2230,7 @@ type
|
|||||||
FReturnValue: Integer;
|
FReturnValue: Integer;
|
||||||
FOnTerminate: TNotifyEvent;
|
FOnTerminate: TNotifyEvent;
|
||||||
FFatalException: TObject;
|
FFatalException: TObject;
|
||||||
FExternalThread: Boolean;
|
FExternalThread, FThreadQueueLockCounted: Boolean;
|
||||||
FSynchronizeEntry: PThreadQueueEntry;
|
FSynchronizeEntry: PThreadQueueEntry;
|
||||||
class function GetCurrentThread: TThread; static;
|
class function GetCurrentThread: TThread; static;
|
||||||
class function GetIsSingleProcessor: Boolean; static; inline;
|
class function GetIsSingleProcessor: Boolean; static; inline;
|
||||||
|
Loading…
Reference in New Issue
Block a user