From 75193aadbece2c52eebbd7e80bd1c4e90b35d9be Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 3 May 2018 18:41:06 +0000 Subject: [PATCH] LazDebuggerFP: Fix logging. Accessing Application.QueueAsync from thread caused leaks git-svn-id: trunk@57780 - --- .../lazdebuggerfp/fpdebugdebugger.pas | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas index 750b0c665b..5e1013bad9 100644 --- a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas @@ -79,7 +79,6 @@ type private FWatchEvalList: TFPList; // Schedule FWatchAsyncQueued: Boolean; - FLogAsyncQueued: boolean; FPrettyPrinter: TFpPascalPrettyPrinter; FDbgController: TDbgController; FFpDebugThread: TFpDebugThread; @@ -114,7 +113,7 @@ type function GetDebugInfo: TDbgInfo; procedure DoWatchFreed(Sender: TObject); procedure ProcessASyncWatches({%H-}Data: PtrInt); - procedure DoLog({%H-}Data: PtrInt); + procedure DoLog(); procedure IncReleaseLock; procedure DecReleaseLock; protected @@ -1350,14 +1349,12 @@ begin end; end; -procedure TFpDebugDebugger.DoLog(Data: PtrInt); +procedure TFpDebugDebugger.DoLog(); var AMessage: TFpDbgLogMessage; AnObjList: TFPObjectList; i: Integer; begin - FLogAsyncQueued:=false; - AnObjList:=TFPObjectList.Create(false); try EnterCriticalsection(FLogCritSection); @@ -1682,11 +1679,7 @@ begin finally LeaveCriticalsection(FLogCritSection); end; - if not FLogAsyncQueued then - begin - FLogAsyncQueued:=true; - Application.QueueAsyncCall(@DoLog, 0); - end; + TThread.Queue(nil, @DoLog); end; procedure TFpDebugDebugger.ExecuteInDebugThread(AMethod: TFpDbgAsyncMethod); @@ -1885,9 +1878,6 @@ end; destructor TFpDebugDebugger.Destroy; begin - if FLogAsyncQueued or FWatchAsyncQueued then - debugln(['WARNING: TFpDebugDebugger.Destroy FLogAsyncQueued=',FLogAsyncQueued,' FWatchAsyncQueued=',FWatchAsyncQueued]); - Application.RemoveAsyncCalls(Self); if assigned(FFpDebugThread) then FreeDebugThread; FreeAndNil(FDbgController);