FreeNotification and opRemove leads to crash
Original Reporter info from Mantis: Martin @martin_frb
-
Reporter name: Martin Friebe
Original Reporter info from Mantis: Martin @martin_frb
- Reporter name: Martin Friebe
Description:
see the program below.
It crashes because opRemove removes one of the 2 paired FreeNotification and lets the other in place.
It works well in Delphi.
http://lists.freepascal.org/lists/fpc-devel/2012-March/028564.html
Steps to reproduce:
program Project1;
{$mode objfpc}{$H+}
uses Classes;
var
Owner, C1, C2: TComponent;
begin
Owner := TComponent.Create(nil);
C1 := TComponent.Create(Owner);
C2 := TComponent.Create(Owner);
C1.FreeNotification(c2);
Owner.RemoveComponent(C1); // C2 Gets on opRemove
C2.Free;
C1.Free; // crash
ReadLn;
end.
Mantis conversion info:
- Mantis ID: 21458
- OS: w32
- OS Build: vista
- Platform: w32
- Version: 2.6.0
- Fixed in version: 3.1.1
- Fixed in revision: compon.inc
- Target version: 3.2.0