mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 17:59:59 +02:00
LazLogger: Init is called from DoDebugLn => make thread save
git-svn-id: trunk@60264 -
This commit is contained in:
parent
4ee1459b01
commit
131d04802a
@ -96,6 +96,7 @@ type
|
||||
|
||||
TLazLogger = class(TRefCountedObject)
|
||||
private
|
||||
FLoggerCriticalSection: TRTLCriticalSection;
|
||||
FIsInitialized: Boolean;
|
||||
|
||||
FMaxNestPrefixLen: Integer;
|
||||
@ -775,6 +776,7 @@ end;
|
||||
|
||||
constructor TLazLogger.Create;
|
||||
begin
|
||||
InitCriticalSection(FLoggerCriticalSection);
|
||||
FIsInitialized := False;
|
||||
FUseGlobalLogGroupList := False;
|
||||
|
||||
@ -790,6 +792,7 @@ begin
|
||||
if TheLazLogger = Self then TheLazLogger := nil;
|
||||
ReleaseRefAndNil(FLogGroupList);
|
||||
inherited Destroy;
|
||||
DoneCriticalsection(FLoggerCriticalSection);
|
||||
end;
|
||||
|
||||
procedure TLazLogger.Assign(Src: TLazLogger);
|
||||
@ -806,9 +809,14 @@ end;
|
||||
|
||||
procedure TLazLogger.Init;
|
||||
begin
|
||||
if FIsInitialized then exit;
|
||||
DoInit;
|
||||
FIsInitialized := True;
|
||||
EnterCriticalsection(FLoggerCriticalSection);
|
||||
try
|
||||
if FIsInitialized then exit;
|
||||
DoInit;
|
||||
FIsInitialized := True;
|
||||
finally
|
||||
LeaveCriticalsection(FLoggerCriticalSection);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLazLogger.Finish;
|
||||
|
Loading…
Reference in New Issue
Block a user