mirror of
https://github.com/moparisthebest/Simba
synced 2025-01-11 05:38:00 -05:00
Fixed (possible) memory leak in param hints.
Fixed an error that I got at closing. Fixed param hints for anonymous functions (var a: procedure(b: Integer) and OnChange for example).
This commit is contained in:
parent
c29d3b66e4
commit
f7aa6ddc93
@ -16,7 +16,7 @@ type
|
|||||||
function RegCreateKeyEx(
|
function RegCreateKeyEx(
|
||||||
Key: LongWord; lpSubKey: TCharArray{PChar}; Reserved: LongInt; lpClass: Integer;
|
Key: LongWord; lpSubKey: TCharArray{PChar}; Reserved: LongInt; lpClass: Integer;
|
||||||
dwOptions: LongInt; samDesired: LongWord; SecurityAttributes: Integer;
|
dwOptions: LongInt; samDesired: LongWord; SecurityAttributes: Integer;
|
||||||
var pResult: LongWord; dwDisposition: TIntegerArray{PInteger}
|
var pResult: LongWord; var dwDisposition: Integer
|
||||||
): LongInt; external 'RegCreateKeyExA@advapi32.dll stdcall';
|
): LongInt; external 'RegCreateKeyExA@advapi32.dll stdcall';
|
||||||
|
|
||||||
function RegCloseKeyEx(
|
function RegCloseKeyEx(
|
||||||
@ -107,11 +107,10 @@ end;
|
|||||||
function RegOpenKey(KeyName: string; Root: LongWord; out Key: LongWord): Boolean;
|
function RegOpenKey(KeyName: string; Root: LongWord; out Key: LongWord): Boolean;
|
||||||
var
|
var
|
||||||
s: TCharArray;
|
s: TCharArray;
|
||||||
disp: TIntegerArray;
|
disp: Integer;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
s := StringToCharArray(KeyName); //Conversion to "PChar"
|
s := StringToCharArray(KeyName); //Conversion to "PChar"
|
||||||
SetLength(disp, 1);
|
|
||||||
case RegCreateKeyEx(Root, s, 0, 0, REG_OPTION_NON_VOLATILE, KEY_WRITE, 0, Key, disp) of
|
case RegCreateKeyEx(Root, s, 0, 0, REG_OPTION_NON_VOLATILE, KEY_WRITE, 0, Key, disp) of
|
||||||
ERROR_SUCCESS: Result := True;
|
ERROR_SUCCESS: Result := True;
|
||||||
ERROR_ACCESS_DENIED: WriteLn('Access denied');
|
ERROR_ACCESS_DENIED: WriteLn('Access denied');
|
||||||
@ -122,7 +121,7 @@ begin
|
|||||||
ERROR_KEY_DELETED: WriteLn('Key marked for deletion');
|
ERROR_KEY_DELETED: WriteLn('Key marked for deletion');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
case disp[0] of
|
case disp of
|
||||||
1: WriteLn('Key "'+KeyName+'" did not exist and was created.');
|
1: WriteLn('Key "'+KeyName+'" did not exist and was created.');
|
||||||
2: WriteLn('Key "'+KeyName+'" existed and was simply opened without being changed.');
|
2: WriteLn('Key "'+KeyName+'" existed and was simply opened without being changed.');
|
||||||
end;
|
end;
|
||||||
|
@ -1794,7 +1794,7 @@ end;
|
|||||||
}
|
}
|
||||||
procedure TSimbaForm.doOnHide(Sender: TObject);
|
procedure TSimbaForm.doOnHide(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if DebugImgForm.Visible then
|
if (not (csDestroying in ComponentState)) and (DebugImgForm <> nil) and DebugImgForm.Showing then
|
||||||
DebugImgForm.Hide;
|
DebugImgForm.Hide;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -582,6 +582,8 @@ var
|
|||||||
i : integer;
|
i : integer;
|
||||||
begin;
|
begin;
|
||||||
result := '';
|
result := '';
|
||||||
|
if (Strings = nil) then
|
||||||
|
exit;
|
||||||
if endpos.y < beginpos.y then
|
if endpos.y < beginpos.y then
|
||||||
exit;
|
exit;
|
||||||
if endpos.y >= strings.Count then
|
if endpos.y >= strings.Count then
|
||||||
@ -612,10 +614,13 @@ var
|
|||||||
CursorXY : TPoint;
|
CursorXY : TPoint;
|
||||||
begin
|
begin
|
||||||
result := -1;
|
result := -1;
|
||||||
|
if (FSynEdit = nil) or (FParameters = nil) then
|
||||||
|
Exit;
|
||||||
MustHide := True;
|
MustHide := True;
|
||||||
Parser := TmwPasLex.Create; //The position of the bracket
|
Parser := TmwPasLex.Create; //The position of the bracket
|
||||||
parser.Origin:= PChar(StringListPartToText(Point(FBracketPoint.x,FBracketPoint.y-1),
|
try
|
||||||
point(min(FSynEdit.CaretX,length(FSynEdit.Lines[FSynEdit.CaretY - 1])+1),FSynEdit.CaretY-1),
|
Parser.Origin:= PChar(StringListPartToText(Point(FBracketPoint.x,FBracketPoint.y-1),
|
||||||
|
Point(min(FSynEdit.CaretX,length(FSynEdit.Lines[FSynEdit.CaretY - 1])+1),FSynEdit.CaretY-1),
|
||||||
FSynEdit.lines));
|
FSynEdit.lines));
|
||||||
bracketcount := 0;
|
bracketcount := 0;
|
||||||
ParameterIndex := -1;
|
ParameterIndex := -1;
|
||||||
@ -642,6 +647,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
parser.NextNoJunk;
|
parser.NextNoJunk;
|
||||||
end;
|
end;
|
||||||
|
finally
|
||||||
|
Parser.Free;
|
||||||
|
end;
|
||||||
if parameterindex = -1 then
|
if parameterindex = -1 then
|
||||||
exit;
|
exit;
|
||||||
if parameterindex = LastParameterIndex then
|
if parameterindex = LastParameterIndex then
|
||||||
@ -653,11 +661,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
str := '';
|
str := '';
|
||||||
ParamC := 0;
|
ParamC := 0;
|
||||||
typedecl := FDecl.Name;
|
{typedecl := FDecl.Name;
|
||||||
if typedecl = nil then
|
if typedecl = nil then
|
||||||
exit;
|
exit;
|
||||||
if typedecl.shorttext = '' then
|
if typedecl.shorttext = '' then
|
||||||
exit;
|
exit;}
|
||||||
for i := 0 to high(FParameters) do
|
for i := 0 to high(FParameters) do
|
||||||
begin
|
begin
|
||||||
if (FParameters[i] is TciConstParameter) then
|
if (FParameters[i] is TciConstParameter) then
|
||||||
@ -703,17 +711,22 @@ begin
|
|||||||
else
|
else
|
||||||
str := s + params + typestr;
|
str := s + params + typestr;
|
||||||
end;
|
end;
|
||||||
TypeDecl := FDecl.Items.GetFirstItemOfClass(TciReturnType);
|
if (FDecl <> nil) then
|
||||||
|
TypeDecl := FDecl.Items.GetFirstItemOfClass(TciReturnType)
|
||||||
|
else
|
||||||
|
TypeDecl := nil;
|
||||||
if TypeDecl <> nil then
|
if TypeDecl <> nil then
|
||||||
TypeStr := ': ' + typedecl.ShortText
|
TypeStr := ': ' + typedecl.ShortText
|
||||||
else
|
else
|
||||||
TypeStr := '';
|
TypeStr := '';
|
||||||
str := FDecl.Name.ShortText + '(' + str + ')' + TypeStr + ';';
|
|
||||||
|
str := '(' + str + ')' + TypeStr + ';';
|
||||||
|
if (FDecl <> nil) and (FDecl.Name <> nil) then
|
||||||
|
str := FDecl.Name.ShortText + str;
|
||||||
str := StringReplace(str,'\\','',[rfReplaceAll]); //Delete all the \\, something like \const \\x\ is the same as \const x\
|
str := StringReplace(str,'\\','',[rfReplaceAll]); //Delete all the \\, something like \const \\x\ is the same as \const x\
|
||||||
MustHide := False;
|
MustHide := False;
|
||||||
Result := parameterindex;
|
Result := parameterindex;
|
||||||
fPreparedString := str;
|
fPreparedString := str;
|
||||||
Parser.Free;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TParamHint.Destroy;
|
destructor TParamHint.Destroy;
|
||||||
@ -742,6 +755,8 @@ var
|
|||||||
ClientXY: TPoint;
|
ClientXY: TPoint;
|
||||||
ScreenXY: TPoint;
|
ScreenXY: TPoint;
|
||||||
begin
|
begin
|
||||||
|
if (FSynEdit = nil) then
|
||||||
|
Exit;
|
||||||
ScreenTextXY := FSynEdit.LogicalToPhysicalPos(FStartPoint);
|
ScreenTextXY := FSynEdit.LogicalToPhysicalPos(FStartPoint);
|
||||||
ClientXY := FSynEdit.RowColumnToPixels(ScreenTextXY);
|
ClientXY := FSynEdit.RowColumnToPixels(ScreenTextXY);
|
||||||
DrawWidth := FSynEdit.ClientWidth; //Maximum width it can have..
|
DrawWidth := FSynEdit.ClientWidth; //Maximum width it can have..
|
||||||
@ -799,6 +814,9 @@ procedure TParamHint.ParamHintHide(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
if FMP <> nil then
|
if FMP <> nil then
|
||||||
freeandnil(Fmp);
|
freeandnil(Fmp);
|
||||||
|
FDecl := nil;
|
||||||
|
FParameters:= nil;
|
||||||
|
FSynEdit := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TParamHint.DrawHints(var MaxWidth, MaxHeight: Integer;
|
procedure TParamHint.DrawHints(var MaxWidth, MaxHeight: Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user