Skip to content

Commit

Permalink
Adjusted leak
Browse files Browse the repository at this point in the history
  • Loading branch information
snakeice committed Apr 9, 2019
1 parent e08ee86 commit abd1277
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
8 changes: 7 additions & 1 deletion src/IDE/Boss.IDE.PojectListener.pas
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ TBossProjectListener = class(TNotifierObject, IOTAIDENotifier)
procedure AddListener(AType: TOTAFileNotification; ACallback: TProc<string>);
procedure RemoveListener(AType: TOTAFileNotification; ACallback: TProc<string>);
class function GetInstance: TBossProjectListener;
destructor Destroy; override;
end;

implementation
Expand Down Expand Up @@ -74,9 +75,14 @@ constructor TBossProjectListener.Create;
FListeners := TObjectDictionary < TOTAFileNotification, TList < TProc<string> >>.Create([doOwnsValues]);
end;

procedure TBossProjectListener.Destroyed;
destructor TBossProjectListener.Destroy;
begin
FListeners.Free;
inherited;
end;

procedure TBossProjectListener.Destroyed;
begin
end;

procedure TBossProjectListener.FileNotification(NotifyCode: TOTAFileNotification; const FileName: string;
Expand Down
5 changes: 2 additions & 3 deletions src/IDE/Boss.IDE.Register.pas
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ initialization

finalization

FNotifierMenuIndex := C_INVALID_NOTIFIER;

if FNotifierMenuIndex > C_INVALID_NOTIFIER then
if FNotifierProjectIndex > C_INVALID_NOTIFIER then
begin
(BorlandIDEServices as IOTAServices).RemoveNotifier(FNotifierProjectIndex);
FNotifierProjectIndex := C_INVALID_NOTIFIER;
end;

if FNotifierMenuIndex > C_INVALID_NOTIFIER then
begin
(BorlandIDEServices as IOTAProjectManager).RemoveMenuItemCreatorNotifier(FNotifierMenuIndex);
Expand Down
7 changes: 0 additions & 7 deletions src/providers/Providers.Message.pas
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ TProviderMessage = class
Procedure Initialize(AService: IOTAMessageServices);
procedure WriteLn(ALine: string);
procedure Clear;
destructor Destroy; override;

end;

Expand All @@ -28,12 +27,6 @@ procedure TProviderMessage.Clear;
FService.ClearMessageGroup(FGroup);
end;

destructor TProviderMessage.Destroy;
begin
FService.RemoveMessageGroup(FGroup);
inherited;
end;

class function TProviderMessage.GetInstance: TProviderMessage;
begin
if not Assigned(FInstance) then
Expand Down

0 comments on commit abd1277

Please sign in to comment.