IDE: fixed AV in Editor->FileSettings->Encoding. Issue #28930

git-svn-id: trunk@50200 -
This commit is contained in:
ondrej 2015-10-30 12:38:55 +00:00
parent a49c8b7c1d
commit e022bfe9e8
2 changed files with 13 additions and 25 deletions

View File

@ -813,7 +813,7 @@ procedure CreateStandardIDECommandScopes;
function CompareIDEShortCuts(Data1, Data2: Pointer): integer;
function CompareIDEShortCutKey1s(Data1, Data2: Pointer): integer;
function CompareEvents(Event1, Event2: TNotifyEvent): Integer;
function IdentToIDECommand(const Ident: string; var Cmd: longint): boolean;
function IDECommandToIdent(Cmd: longint; var Ident: string): boolean;
procedure GetIDEEditorCommandValues(Proc: TGetStrProc);
@ -1287,7 +1287,7 @@ procedure TIDECommand.SetOnExecute(const aOnExecute: TNotifyEvent);
var
xUser: TIDESpecialCommand;
begin
if FOnExecute = aOnExecute then Exit;
if CompareEvents(FOnExecute, aOnExecute) = 0 then Exit;
FOnExecute := aOnExecute;
for xUser in FUsers do
xUser.OnClick := FOnExecute;
@ -1694,7 +1694,7 @@ end;
procedure TIDESpecialCommand.SetOnClickMethod(const aOnClick: TNotifyEvent);
begin
if FOnClickMethod = aOnClick then Exit;
if CompareEvents(FOnClickMethod, aOnClick) = 0 then Exit;
FOnClickMethod := aOnClick;
if FCommand<> nil then
FCommand.OnExecute:=aOnClick;
@ -2180,6 +2180,16 @@ const
(Value: ecIdePSyncroEdSelStart; Name: 'ecIdePSyncroEdSelStart')
);
function CompareEvents(Event1, Event2: TNotifyEvent): Integer;
var
xMethod1: TMethod absolute Event1;
xMethod2: TMethod absolute Event2;
begin
Result := ComparePointers(xMethod1.Code, xMethod2.Code);
if Result<>0 then Exit;
Result := ComparePointers(xMethod1.Data, xMethod2.Data);
end;
function IdentToIDECommand(const Ident: string; var Cmd: longint): boolean;
begin
Result := IdentToInt(Ident, Cmd, IDEEditorCommandStrs);

View File

@ -209,8 +209,6 @@ type
procedure SetRightJustify(const AValue: boolean); virtual;
procedure SetShowAlwaysCheckable(const AValue: boolean); virtual;
procedure SetMenuItem(const AValue: TMenuItem); override;
procedure SetOnClickMethod(const AValue: TNotifyEvent); override;
procedure SetOnClickProc(const AValue: TNotifyProcedure); override;
public
property AutoCheck: boolean read FAutoCheck write SetAutoCheck default False;
property Default: Boolean read FDefault write SetDefault default False;
@ -1676,26 +1674,6 @@ begin
end;
end;
procedure TIDEMenuCommand.SetOnClickMethod(const AValue: TNotifyEvent);
var
OldClick: TNotifyEvent;
begin
OldClick:=OnClick;
inherited SetOnClickMethod(AValue);
if Assigned(Command) and (Command.OnExecute = OldClick) then
Command.OnExecute := OnClick;
end;
procedure TIDEMenuCommand.SetOnClickProc(const AValue: TNotifyProcedure);
var
OldClick: TNotifyProcedure;
begin
OldClick:=OnClickProc;
inherited SetOnClickProc(AValue);
if Assigned(Command) and (Command.OnExecuteProc = OldClick) then
Command.OnExecuteProc := OnClickProc;
end;
{ TIDEMenuRoots }
function TIDEMenuRoots.GetItems(Index: integer): TIDEMenuSection;