mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 14:29:33 +02:00
chmhelp: fixed mem leak
git-svn-id: trunk@31314 -
This commit is contained in:
parent
dc24fe5d73
commit
d400a7e51a
@ -5,31 +5,38 @@ unit ChmLcl;
|
||||
interface
|
||||
|
||||
uses
|
||||
LazHelpIntf, HelpFPDoc;
|
||||
Classes, LazHelpIntf, HelpFPDoc;
|
||||
|
||||
const
|
||||
sLclUnits = 'LCL - Lazarus component library';
|
||||
|
||||
type
|
||||
|
||||
{ TLclChmHelpDatabase }
|
||||
|
||||
TLclChmHelpDatabase = class(TFPDocHTMLHelpDatabase)
|
||||
private
|
||||
FBaseURL: THelpBaseURLObject;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
procedure RegisterLclHelpDatabase;
|
||||
|
||||
var
|
||||
LCLHelpDatabase: TFPDocHTMLHelpDatabase = nil;
|
||||
LCLHelpDatabase: TLclChmHelpDatabase = nil;
|
||||
|
||||
implementation
|
||||
|
||||
procedure RegisterLclHelpDatabase;
|
||||
var
|
||||
FPDocNode: THelpNode;
|
||||
BaseURL: THelpBaseURLObject;
|
||||
DirItem: THelpDBISourceDirectory;
|
||||
begin
|
||||
if Assigned(LCLHelpDatabase) then Exit;
|
||||
LCLHelpDatabase := TFPDocHTMLHelpDatabase(
|
||||
HelpDatabases.CreateHelpDatabase(sLclUnits, TFPDocHTMLHelpDatabase, True));
|
||||
|
||||
BaseURL := THelpBaseURLObject.Create;
|
||||
BaseURL.BaseURL := 'lcl.chm://';
|
||||
LCLHelpDatabase.BasePathObject := BaseURL;
|
||||
LCLHelpDatabase := TLclChmHelpDatabase(
|
||||
HelpDatabases.CreateHelpDatabase(sLclUnits, TLclChmHelpDatabase, True));
|
||||
|
||||
// FPDoc nodes for units in the LCL
|
||||
FPDocNode := THelpNode.CreateURL(LCLHelpDatabase,
|
||||
@ -41,5 +48,21 @@ begin
|
||||
LCLHelpDatabase.RegisterItem(DirItem);
|
||||
end;
|
||||
|
||||
{ TLclChmHelpDatabase }
|
||||
|
||||
constructor TLclChmHelpDatabase.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FBaseURL := THelpBaseURLObject.Create;
|
||||
FBaseURL.BaseURL := 'lcl.chm://';
|
||||
BasePathObject := FBaseURL;
|
||||
end;
|
||||
|
||||
destructor TLclChmHelpDatabase.Destroy;
|
||||
begin
|
||||
FBaseURL.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user