mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 09:39:18 +02:00
FpDebug: Fix mem leak, if breakpoint is set to "auto destroy"
This commit is contained in:
parent
fd792b5d6f
commit
5d6489a45a
@ -478,6 +478,7 @@ type
|
|||||||
FEnabled: boolean;
|
FEnabled: boolean;
|
||||||
FOn_Thread_StateChange: TFpDbgBreakpointStateChangeEvent;
|
FOn_Thread_StateChange: TFpDbgBreakpointStateChangeEvent;
|
||||||
protected
|
protected
|
||||||
|
procedure SetFreeByDbgProcess(AValue: Boolean); virtual;
|
||||||
procedure SetEnabled(AValue: boolean);
|
procedure SetEnabled(AValue: boolean);
|
||||||
function GetState: TFpDbgBreakpointState; virtual;
|
function GetState: TFpDbgBreakpointState; virtual;
|
||||||
public
|
public
|
||||||
@ -493,7 +494,8 @@ type
|
|||||||
procedure ResetBreak; virtual; abstract;
|
procedure ResetBreak; virtual; abstract;
|
||||||
|
|
||||||
// FreeByDbgProcess: The breakpoint will be freed by TDbgProcess.Destroy
|
// FreeByDbgProcess: The breakpoint will be freed by TDbgProcess.Destroy
|
||||||
property FreeByDbgProcess: Boolean read FFreeByDbgProcess write FFreeByDbgProcess;
|
// If the breakpoint does not have a process, it will be destroyed immediately
|
||||||
|
property FreeByDbgProcess: Boolean read FFreeByDbgProcess write SetFreeByDbgProcess;
|
||||||
property Enabled: boolean read FEnabled write SetEnabled;
|
property Enabled: boolean read FEnabled write SetEnabled;
|
||||||
property State: TFpDbgBreakpointState read GetState;
|
property State: TFpDbgBreakpointState read GetState;
|
||||||
// Event runs in dbg-thread
|
// Event runs in dbg-thread
|
||||||
@ -506,6 +508,7 @@ type
|
|||||||
private
|
private
|
||||||
FProcess: TDbgProcess;
|
FProcess: TDbgProcess;
|
||||||
protected
|
protected
|
||||||
|
procedure SetFreeByDbgProcess(AValue: Boolean); override;
|
||||||
procedure UpdateForLibraryLoaded(ALib: TDbgLibrary); virtual;
|
procedure UpdateForLibraryLoaded(ALib: TDbgLibrary); virtual;
|
||||||
procedure UpdateForLibrareUnloaded(ALib: TDbgLibrary); virtual;
|
procedure UpdateForLibrareUnloaded(ALib: TDbgLibrary); virtual;
|
||||||
property Process: TDbgProcess read FProcess;
|
property Process: TDbgProcess read FProcess;
|
||||||
@ -1014,6 +1017,11 @@ begin
|
|||||||
Result := bksUnknown;
|
Result := bksUnknown;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFpDbgBreakpoint.SetFreeByDbgProcess(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
FFreeByDbgProcess := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFpDbgBreakpoint.SetEnabled(AValue: boolean);
|
procedure TFpDbgBreakpoint.SetEnabled(AValue: boolean);
|
||||||
begin
|
begin
|
||||||
if AValue then
|
if AValue then
|
||||||
@ -3687,6 +3695,13 @@ end;
|
|||||||
|
|
||||||
{ TFpInternalBreakBase }
|
{ TFpInternalBreakBase }
|
||||||
|
|
||||||
|
procedure TFpInternalBreakBase.SetFreeByDbgProcess(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
inherited SetFreeByDbgProcess(AValue);
|
||||||
|
if AValue and (FProcess = nil) then
|
||||||
|
Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFpInternalBreakBase.UpdateForLibraryLoaded(ALib: TDbgLibrary);
|
procedure TFpInternalBreakBase.UpdateForLibraryLoaded(ALib: TDbgLibrary);
|
||||||
begin
|
begin
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user