Skip to content

Commit

Permalink
Merge commit '09a18f4' (Memory leak fix) into rel-1.85.1
Browse files Browse the repository at this point in the history
  • Loading branch information
w7sst committed Oct 21, 2024
2 parents 2c37664 + 09a18f4 commit 0281843
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 10 additions & 2 deletions DXCC.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
interface

uses
Generics.Collections,
Classes;

type
Expand All @@ -18,12 +19,13 @@ TDXCCRec= class

TDXCC= class
private
DXCCList: TList;
DXCCList: TObjectList<TDXCCRec>;
procedure LoadDxCCList;
procedure Delimit(var AStringList: TStringList; const AText: string);
function SearchPrefix(out index : integer; const ACallPrefix : string) : Boolean;
public
constructor Create;
destructor Destroy; override;
function FindRec(out dxrec : TDXCCRec; const ACallsign : string) : Boolean;
function GetStationInfo(const ACallsign: string): string;
function Search(ACallsign: string): string;
Expand All @@ -46,7 +48,7 @@ procedure TDXCC.LoadDxCCList;
slst:= TStringList.Create;
tl:= TStringList.Create;
try
DXCCList:= TList.Create;
DXCCList:= TObjectList<TDXCCRec>.Create;
slst.LoadFromFile(ParamStr(1) + 'DXCC.LIST');

// The search algorithm walks this list in reverse order.
Expand Down Expand Up @@ -77,6 +79,12 @@ constructor TDXCC.Create;
LoadDxCCList;
end;


destructor TDXCC.Destroy;
begin
FreeAndNil(DXCCList);
end;

// search ARRL DXCC prefix records for given callsign prefix.
function TDXCC.SearchPrefix(out index : integer; const ACallPrefix : string) : Boolean;
var
Expand Down
4 changes: 4 additions & 0 deletions Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ function Edit2IsRST: Boolean;

procedure TMainForm.FormCreate(Sender: TObject);
begin
{$ifdef DEBUG}
// detect/report memory leaks while in debug mode
System.ReportMemoryLeaksOnShutdown := True;
{$endif}
Randomize;

Panel2.DoubleBuffered := True;
Expand Down
4 changes: 2 additions & 2 deletions NaQp.pas
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TNaQpCallRec = class

TNcjNaQp = class(TDualExchContest)
private
NaQpCallList: TList<TNaQpCallRec>;
NaQpCallList: TObjectList<TNaQpCallRec>;
Comparer: IComparer<TNaQpCallRec>;

public
Expand Down Expand Up @@ -202,7 +202,7 @@ constructor TNcjNaQp.Create;
begin
inherited Create(etOpName, etNaQpExch2, // NA station exchange
etOpName, etNaQpNonNaExch2); // non-NA station exchange
NaQpCallList := TList<TNaQpCallRec>.Create;
NaQpCallList := TObjectList<TNaQpCallRec>.Create;
Comparer := TComparer<TNaQpCallRec>.Construct(TNaQpCallRec.compareCall);
end;

Expand Down

0 comments on commit 0281843

Please sign in to comment.