mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 15:59:13 +02:00
LazDebuggerFP: Fix logging. Accessing Application.QueueAsync from thread caused leaks
git-svn-id: trunk@57780 -
This commit is contained in:
parent
c946f67b86
commit
75193aadbe
@ -79,7 +79,6 @@ type
|
|||||||
private
|
private
|
||||||
FWatchEvalList: TFPList; // Schedule
|
FWatchEvalList: TFPList; // Schedule
|
||||||
FWatchAsyncQueued: Boolean;
|
FWatchAsyncQueued: Boolean;
|
||||||
FLogAsyncQueued: boolean;
|
|
||||||
FPrettyPrinter: TFpPascalPrettyPrinter;
|
FPrettyPrinter: TFpPascalPrettyPrinter;
|
||||||
FDbgController: TDbgController;
|
FDbgController: TDbgController;
|
||||||
FFpDebugThread: TFpDebugThread;
|
FFpDebugThread: TFpDebugThread;
|
||||||
@ -114,7 +113,7 @@ type
|
|||||||
function GetDebugInfo: TDbgInfo;
|
function GetDebugInfo: TDbgInfo;
|
||||||
procedure DoWatchFreed(Sender: TObject);
|
procedure DoWatchFreed(Sender: TObject);
|
||||||
procedure ProcessASyncWatches({%H-}Data: PtrInt);
|
procedure ProcessASyncWatches({%H-}Data: PtrInt);
|
||||||
procedure DoLog({%H-}Data: PtrInt);
|
procedure DoLog();
|
||||||
procedure IncReleaseLock;
|
procedure IncReleaseLock;
|
||||||
procedure DecReleaseLock;
|
procedure DecReleaseLock;
|
||||||
protected
|
protected
|
||||||
@ -1350,14 +1349,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFpDebugDebugger.DoLog(Data: PtrInt);
|
procedure TFpDebugDebugger.DoLog();
|
||||||
var
|
var
|
||||||
AMessage: TFpDbgLogMessage;
|
AMessage: TFpDbgLogMessage;
|
||||||
AnObjList: TFPObjectList;
|
AnObjList: TFPObjectList;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
FLogAsyncQueued:=false;
|
|
||||||
|
|
||||||
AnObjList:=TFPObjectList.Create(false);
|
AnObjList:=TFPObjectList.Create(false);
|
||||||
try
|
try
|
||||||
EnterCriticalsection(FLogCritSection);
|
EnterCriticalsection(FLogCritSection);
|
||||||
@ -1682,11 +1679,7 @@ begin
|
|||||||
finally
|
finally
|
||||||
LeaveCriticalsection(FLogCritSection);
|
LeaveCriticalsection(FLogCritSection);
|
||||||
end;
|
end;
|
||||||
if not FLogAsyncQueued then
|
TThread.Queue(nil, @DoLog);
|
||||||
begin
|
|
||||||
FLogAsyncQueued:=true;
|
|
||||||
Application.QueueAsyncCall(@DoLog, 0);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFpDebugDebugger.ExecuteInDebugThread(AMethod: TFpDbgAsyncMethod);
|
procedure TFpDebugDebugger.ExecuteInDebugThread(AMethod: TFpDbgAsyncMethod);
|
||||||
@ -1885,9 +1878,6 @@ end;
|
|||||||
|
|
||||||
destructor TFpDebugDebugger.Destroy;
|
destructor TFpDebugDebugger.Destroy;
|
||||||
begin
|
begin
|
||||||
if FLogAsyncQueued or FWatchAsyncQueued then
|
|
||||||
debugln(['WARNING: TFpDebugDebugger.Destroy FLogAsyncQueued=',FLogAsyncQueued,' FWatchAsyncQueued=',FWatchAsyncQueued]);
|
|
||||||
Application.RemoveAsyncCalls(Self);
|
|
||||||
if assigned(FFpDebugThread) then
|
if assigned(FFpDebugThread) then
|
||||||
FreeDebugThread;
|
FreeDebugThread;
|
||||||
FreeAndNil(FDbgController);
|
FreeAndNil(FDbgController);
|
||||||
|
Loading…
Reference in New Issue
Block a user