Fix for TCollection.Destroy
Original Reporter info from Mantis: fvi
-
Reporter name: Filiuta Vitali
Original Reporter info from Mantis: fvi
- Reporter name: Filiuta Vitali
Description:
destructor TCollection.Destroy;
begin
FUpdateCount:=1; // Prevent OnChange
try
DoClear;
Finally
FUpdateCount:=0;
end;
FItems.Free;
Inherited Destroy;
end;
You should not call DoClear, without checking, that FItems <> nil. If constructor of descendant class fails (it might happen), destructor will be called, and FItems could be nil here, so we will get an EAccessViolation, that will hide more informative exception (from constructor).
Patch is attached.
Mantis conversion info:
- Mantis ID: 33516
- Version: 3.1.1
- Fixed in version: 3.1.1
- Fixed in revision: 38627 (#31a354a3)
- Target version: 3.2.0