TStringList.OwnsObjects not works in TStringList.Destroy
Original Reporter info from Mantis: skyweb
-
Reporter name:
Original Reporter info from Mantis: skyweb
- Reporter name:
Description:
var sl: TStringList;
begin
sl := TStringList.Create;
sl.OwnsObjects := true;
sl.AddObject('a',TMyObject.Create());
sl.Free;
// BUG: the sl.Objects[0] will not free!
sl := TStringList.Create;
sl.OwnsObjects := true;
sl.AddObject('a',TMyObject.Create());
sl.Clear; // the sl.Objects[0] is free now !
sl.Free;
end
Steps to reproduce:
see attachment for the bug demo source.
Mantis conversion info:
- Mantis ID: 23455
- OS: any
- OS Build: any
- Build: 2011/12/23
- Platform: any
- Version: 2.6.0
- Fixed in version: 2.6.2
- Target version: 2.7.1