IdeIntf: Improve locking of TObjectInspectorDlg.SetSelection.

git-svn-id: trunk@52236 -
This commit is contained in:
juha 2016-04-22 20:02:12 +00:00
parent e692bb38fe
commit 2b97e8c1c4

View File

@ -738,7 +738,7 @@ type
procedure DoZOrderItemClick(Sender: TObject);
private
FEnableHookGetSelection: boolean;
FInSelection: Boolean;
FSettingSelectionCount: integer;
FRefreshingSelectionCount: integer;
FOnAutoShow: TNotifyEvent;
FLastActiveRowName: String;
@ -4628,15 +4628,17 @@ end;
procedure TObjectInspectorDlg.SetSelection(const ASelection: TPersistentSelectionList);
begin
if ASelection<>nil then begin
if FSelection.IsEqual(ASelection) then // Nothing changed or endless loop -> quit.
if FInSelection or not ASelection.ForceUpdate then exit;
end else begin
if FSelection.Count=0 then exit;
end;
Assert(not FInSelection, 'TObjectInspectorDlg.SetSelection: Already setting selection.');
FInSelection := True;
if FSettingSelectionCount > 0 then Exit; // Prevent a recursive loop.
Inc(FSettingSelectionCount);
try
if ASelection<>nil then begin
// Nothing changed or endless loop -> quit.
if FSelection.IsEqual(ASelection) and not ASelection.ForceUpdate then
Exit;
end else begin
if FSelection.Count=0 then
Exit;
end;
// ToDo: Clear filter only if a selected node is hidden (Visible=False)
CompFilterEdit.Filter:='';
if ASelection<>nil then
@ -4648,7 +4650,7 @@ begin
if Assigned(FOnSelectPersistentsInOI) then
FOnSelectPersistentsInOI(Self);
finally
FInSelection := False;
Dec(FSettingSelectionCount);
end;
end;