1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-02-16 07:10:10 -05:00

Fixed another (possible) memory leak in param hints

This commit is contained in:
Niels 2010-05-24 00:17:21 +02:00
parent 21286973fd
commit 2d8389be3e
2 changed files with 11 additions and 7 deletions

View File

@ -426,7 +426,7 @@ begin
if (d <> nil) then if (d <> nil) then
begin begin
d := TciTypeKind(d).GetRealType; d := TciTypeKind(d).GetRealType;
if (d is TciReturnType) then if (d <> nil) and (d is TciReturnType) then
d := d.Owner; d := d.Owner;
end; end;
if (d <> nil) and (d.Owner <> nil) and (not ((d is TciProcedureDeclaration) or (d.Owner is TciProcedureDeclaration))) then if (d <> nil) and (d.Owner <> nil) and (not ((d is TciProcedureDeclaration) or (d.Owner is TciProcedureDeclaration))) then

View File

@ -614,7 +614,7 @@ var
CursorXY : TPoint; CursorXY : TPoint;
begin begin
result := -1; result := -1;
if (FSynEdit = nil) or (FParameters = nil) then if (FSynEdit = nil) then
Exit; Exit;
MustHide := True; MustHide := True;
Parser := TmwPasLex.Create; //The position of the bracket Parser := TmwPasLex.Create; //The position of the bracket
@ -812,10 +812,9 @@ end;
procedure TParamHint.ParamHintHide(Sender: TObject); procedure TParamHint.ParamHintHide(Sender: TObject);
begin begin
if FMP <> nil then if Fmp <> nil then
freeandnil(Fmp); FreeAndNil(Fmp);
FDecl := nil; FDecl := nil;
FParameters:= nil;
FSynEdit := nil; FSynEdit := nil;
end; end;
@ -976,14 +975,19 @@ procedure TParamHint.Show(StartPoint,BracketPoint: TPoint;Decl : TciProcedureDec
begin begin
if self.Visible then if self.Visible then
self.hide; self.hide;
FDecl := Decl;
Fmp := mp; Fmp := mp;
FParameters:= Decl.GetParamDeclarations; FParameters:= Decl.GetParamDeclarations;
if Length(FParameters) = 0 then //Method has no Parameters if Length(FParameters) = 0 then //Method has no Parameters
exit; begin
FreeAndNil(Fmp);
Exit;
end;
FDecl := Decl;
FSynEdit := Editor; FSynEdit := Editor;
FStartPoint:= StartPoint; FStartPoint:= StartPoint;
FBracketPoint:= BracketPoint; FBracketPoint:= BracketPoint;
CalculateBounds; //Calculate the size we need! CalculateBounds; //Calculate the size we need!
self.Visible := true; self.Visible := true;
end; end;