mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 03:19:17 +02:00
IDE: Assign also the handler list in BuildModes. Prevents a crash when cancelling project options. Issue #36782.
git-svn-id: trunk@63009 -
This commit is contained in:
parent
ed5d93546e
commit
cbaeca66f0
@ -47,6 +47,8 @@ type
|
|||||||
function Count: integer;
|
function Count: integer;
|
||||||
function NextDownIndex(var Index: integer): boolean;
|
function NextDownIndex(var Index: integer): boolean;
|
||||||
function IndexOf(const AMethod: TMethod): integer;
|
function IndexOf(const AMethod: TMethod): integer;
|
||||||
|
procedure Assign(Source: TMethodList);
|
||||||
|
procedure Clear;
|
||||||
procedure Delete(Index: integer);
|
procedure Delete(Index: integer);
|
||||||
procedure Remove(const AMethod: TMethod);
|
procedure Remove(const AMethod: TMethod);
|
||||||
procedure Add(const AMethod: TMethod);
|
procedure Add(const AMethod: TMethod);
|
||||||
@ -177,7 +179,7 @@ end;
|
|||||||
|
|
||||||
destructor TMethodList.Destroy;
|
destructor TMethodList.Destroy;
|
||||||
begin
|
begin
|
||||||
ReAllocMem(FItems,0);
|
Clear;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -218,6 +220,20 @@ begin
|
|||||||
Result:=-1;
|
Result:=-1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMethodList.Assign(Source: TMethodList);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Clear;
|
||||||
|
for i := 0 to Source.Count-1 do
|
||||||
|
Add(Source.Items[i]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMethodList.Clear;
|
||||||
|
begin
|
||||||
|
ReAllocMem(FItems,0);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMethodList.Delete(Index: integer);
|
procedure TMethodList.Delete(Index: integer);
|
||||||
begin
|
begin
|
||||||
dec(FCount);
|
dec(FCount);
|
||||||
|
@ -611,7 +611,7 @@ type
|
|||||||
fSavedChangeStamp: int64;
|
fSavedChangeStamp: int64;
|
||||||
fItems: TFPList;
|
fItems: TFPList;
|
||||||
FLazProject: TProject;
|
FLazProject: TProject;
|
||||||
fOnChanged: TMethodList;
|
fChangedHandlers: TMethodList;
|
||||||
// Variables used by LoadFromXMLConfig and SaveToXMLConfig
|
// Variables used by LoadFromXMLConfig and SaveToXMLConfig
|
||||||
FXMLConfig: TXMLConfig;
|
FXMLConfig: TXMLConfig;
|
||||||
FGlobalMatrixOptions: TBuildMatrixOptions;
|
FGlobalMatrixOptions: TBuildMatrixOptions;
|
||||||
@ -671,6 +671,8 @@ type
|
|||||||
property SharedMatrixOptions: TBuildMatrixOptions read FSharedMatrixOptions;
|
property SharedMatrixOptions: TBuildMatrixOptions read FSharedMatrixOptions;
|
||||||
property SessionMatrixOptions: TBuildMatrixOptions read FSessionMatrixOptions;
|
property SessionMatrixOptions: TBuildMatrixOptions read FSessionMatrixOptions;
|
||||||
property ManyBuildModes: TStringList read FManyBuildModes;
|
property ManyBuildModes: TStringList read FManyBuildModes;
|
||||||
|
property ChangedHandlers: TMethodList read fChangedHandlers;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TProjectIDEOptions }
|
{ TProjectIDEOptions }
|
||||||
@ -7000,7 +7002,7 @@ end;
|
|||||||
constructor TProjectBuildModes.Create(AOwner: TComponent);
|
constructor TProjectBuildModes.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
fOnChanged:=TMethodList.Create;
|
fChangedHandlers:=TMethodList.Create;
|
||||||
fItems:=TFPList.Create;
|
fItems:=TFPList.Create;
|
||||||
FChangeStamp:=CTInvalidChangeStamp;
|
FChangeStamp:=CTInvalidChangeStamp;
|
||||||
fSavedChangeStamp:=FChangeStamp;
|
fSavedChangeStamp:=FChangeStamp;
|
||||||
@ -7013,7 +7015,7 @@ end;
|
|||||||
|
|
||||||
destructor TProjectBuildModes.Destroy;
|
destructor TProjectBuildModes.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(fOnChanged);
|
FreeAndNil(fChangedHandlers);
|
||||||
Clear;
|
Clear;
|
||||||
FreeAndNil(FManyBuildModes);
|
FreeAndNil(FManyBuildModes);
|
||||||
FreeAndNil(FSharedMatrixOptions);
|
FreeAndNil(FSharedMatrixOptions);
|
||||||
@ -7024,9 +7026,11 @@ end;
|
|||||||
|
|
||||||
procedure TProjectBuildModes.Clear;
|
procedure TProjectBuildModes.Clear;
|
||||||
begin
|
begin
|
||||||
while Count>0 do Delete(Count-1);
|
while Count>0 do
|
||||||
|
Delete(Count-1);
|
||||||
SharedMatrixOptions.Clear;
|
SharedMatrixOptions.Clear;
|
||||||
SessionMatrixOptions.Clear;
|
SessionMatrixOptions.Clear;
|
||||||
|
//fChangedHandlers.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProjectBuildModes.IsEqual(OtherModes: TProjectBuildModes): boolean;
|
function TProjectBuildModes.IsEqual(OtherModes: TProjectBuildModes): boolean;
|
||||||
@ -7062,6 +7066,7 @@ begin
|
|||||||
SharedMatrixOptions.Assign(OtherModes.SharedMatrixOptions);
|
SharedMatrixOptions.Assign(OtherModes.SharedMatrixOptions);
|
||||||
SessionMatrixOptions.Assign(OtherModes.SessionMatrixOptions);
|
SessionMatrixOptions.Assign(OtherModes.SessionMatrixOptions);
|
||||||
ManyBuildModes.Assign(OtherModes.ManyBuildModes);
|
ManyBuildModes.Assign(OtherModes.ManyBuildModes);
|
||||||
|
ChangedHandlers.Assign(OtherModes.ChangedHandlers);
|
||||||
if WithModified then
|
if WithModified then
|
||||||
Modified:=OtherModes.Modified;
|
Modified:=OtherModes.Modified;
|
||||||
FAssigning:=False;
|
FAssigning:=False;
|
||||||
@ -7129,17 +7134,17 @@ end;
|
|||||||
procedure TProjectBuildModes.IncreaseChangeStamp;
|
procedure TProjectBuildModes.IncreaseChangeStamp;
|
||||||
begin
|
begin
|
||||||
CTIncreaseChangeStamp(FChangeStamp);
|
CTIncreaseChangeStamp(FChangeStamp);
|
||||||
if fOnChanged<>nil then fOnChanged.CallNotifyEvents(Self);
|
if fChangedHandlers<>nil then fChangedHandlers.CallNotifyEvents(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectBuildModes.AddOnChangedHandler(const Handler: TNotifyEvent);
|
procedure TProjectBuildModes.AddOnChangedHandler(const Handler: TNotifyEvent);
|
||||||
begin
|
begin
|
||||||
fOnChanged.Add(TMethod(Handler));
|
fChangedHandlers.Add(TMethod(Handler));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectBuildModes.RemoveOnChangedHandler(const Handler: TNotifyEvent);
|
procedure TProjectBuildModes.RemoveOnChangedHandler(const Handler: TNotifyEvent);
|
||||||
begin
|
begin
|
||||||
fOnChanged.Remove(TMethod(Handler));
|
fChangedHandlers.Remove(TMethod(Handler));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProjectBuildModes.IsModified(InSession: boolean): boolean;
|
function TProjectBuildModes.IsModified(InSession: boolean): boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user