diff --git a/components/fpdebug/fpdbgclasses.pp b/components/fpdebug/fpdbgclasses.pp index f63f9deccc..62890f035a 100644 --- a/components/fpdebug/fpdbgclasses.pp +++ b/components/fpdebug/fpdbgclasses.pp @@ -478,6 +478,7 @@ type FEnabled: boolean; FOn_Thread_StateChange: TFpDbgBreakpointStateChangeEvent; protected + procedure SetFreeByDbgProcess(AValue: Boolean); virtual; procedure SetEnabled(AValue: boolean); function GetState: TFpDbgBreakpointState; virtual; public @@ -493,7 +494,8 @@ type procedure ResetBreak; virtual; abstract; // 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 State: TFpDbgBreakpointState read GetState; // Event runs in dbg-thread @@ -506,6 +508,7 @@ type private FProcess: TDbgProcess; protected + procedure SetFreeByDbgProcess(AValue: Boolean); override; procedure UpdateForLibraryLoaded(ALib: TDbgLibrary); virtual; procedure UpdateForLibrareUnloaded(ALib: TDbgLibrary); virtual; property Process: TDbgProcess read FProcess; @@ -1014,6 +1017,11 @@ begin Result := bksUnknown; end; +procedure TFpDbgBreakpoint.SetFreeByDbgProcess(AValue: Boolean); +begin + FFreeByDbgProcess := AValue; +end; + procedure TFpDbgBreakpoint.SetEnabled(AValue: boolean); begin if AValue then @@ -3687,6 +3695,13 @@ end; { TFpInternalBreakBase } +procedure TFpInternalBreakBase.SetFreeByDbgProcess(AValue: Boolean); +begin + inherited SetFreeByDbgProcess(AValue); + if AValue and (FProcess = nil) then + Destroy; +end; + procedure TFpInternalBreakBase.UpdateForLibraryLoaded(ALib: TDbgLibrary); begin //