mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 14:18:17 +02:00
IdeDebugger: add Destroy-callback to TIDEBreakPointGroup
This commit is contained in:
parent
cc98242bec
commit
25db56ee57
@ -19,6 +19,19 @@ uses
|
||||
|
||||
type
|
||||
|
||||
{ TFreeNotifyingGeneric }
|
||||
|
||||
generic TFreeNotifyingGeneric<_B: TObject> = class(_B)
|
||||
private
|
||||
FFreeNotificationList: TMethodList;
|
||||
protected
|
||||
procedure DoDestroy; // FPC can not compile "destructor Destroy; override;"
|
||||
public
|
||||
//destructor Destroy; override;
|
||||
procedure AddFreeNotification(ANotification: TNotifyEvent);
|
||||
procedure RemoveFreeNotification(ANotification: TNotifyEvent);
|
||||
end;
|
||||
|
||||
{ TFreeNotifyingObject }
|
||||
|
||||
TFreeNotifyingObject = class
|
||||
@ -86,6 +99,33 @@ procedure NilThenReleaseRef(var ARefCountedObject; DebugIdAdr: Pointer; DebugIdT
|
||||
{$ENDIF}
|
||||
|
||||
implementation
|
||||
|
||||
{ TFreeNotifyingGeneric }
|
||||
|
||||
procedure TFreeNotifyingGeneric.DoDestroy;
|
||||
begin
|
||||
if FFreeNotificationList <> nil then
|
||||
FFreeNotificationList.CallNotifyEvents(Self);
|
||||
inherited Destroy;
|
||||
FreeAndNil(FFreeNotificationList);
|
||||
end;
|
||||
|
||||
procedure TFreeNotifyingGeneric.AddFreeNotification(ANotification: TNotifyEvent
|
||||
);
|
||||
begin
|
||||
if FFreeNotificationList = nil then
|
||||
FFreeNotificationList := TMethodList.Create;
|
||||
FFreeNotificationList.Add(TMethod(ANotification));
|
||||
end;
|
||||
|
||||
procedure TFreeNotifyingGeneric.RemoveFreeNotification(
|
||||
ANotification: TNotifyEvent);
|
||||
begin
|
||||
if FFreeNotificationList = nil then
|
||||
exit;
|
||||
FFreeNotificationList.Remove(TMethod(ANotification));
|
||||
end;
|
||||
|
||||
{$IFDEF WITH_REFCOUNT_DEBUG}
|
||||
uses LazLoggerBase;
|
||||
{$IFDEF WITH_REFCOUNT_LEAK_DEBUG}
|
||||
|
@ -421,7 +421,7 @@ type
|
||||
|
||||
{ TIDEBreakPointGroup }
|
||||
|
||||
TIDEBreakPointGroup = class(TCollectionItem)
|
||||
TIDEBreakPointGroup = class(specialize TFreeNotifyingGeneric<TCollectionItem>)
|
||||
private
|
||||
FEnabled: Boolean;
|
||||
FInitialEnabled: Boolean;
|
||||
@ -6421,6 +6421,7 @@ begin
|
||||
for n := FReferences.Count - 1 downto 0 do
|
||||
TIDEBreakPointGroupList(FReferences[n]).Remove(Self);
|
||||
|
||||
DoDestroy;
|
||||
inherited Destroy;
|
||||
FreeAndNil(FBreakpoints);
|
||||
FreeAndNil(FReferences);
|
||||
|
Loading…
Reference in New Issue
Block a user