diff --git a/ideintf/objectinspector.pp b/ideintf/objectinspector.pp index 45d6a32305..f1cf408d1c 100644 --- a/ideintf/objectinspector.pp +++ b/ideintf/objectinspector.pp @@ -2004,7 +2004,8 @@ procedure TOICustomPropertyGrid.ClearRows; var a:integer; begin IncreaseChangeStep; - for a:=0 to FRows.Count-1 do begin + // reverse order to make sure child rows are freed before parent rows + for a:=FRows.Count-1 downto 0 do begin Rows[a].Free; end; FRows.Clear;