I have an application that was leaking. The odd thing is it worked before moving it from XE to XE3. So what's I find out?
I have an application that was leaking. The odd thing is it worked before moving it from XE to XE3. So what's I find out?
I have a class inheriting from TObjectList. In the constructor, it was calling "inherited" and I realized that XE3 doesn't behave like XE. In XE3 "inherited" called the TObject.Create rather than the immediate parent TObjectList.Create, thus not setting FOwnsObjects := True;.
type
TOList = class(TObjectList)
public
constructor Create;
end;
{ TOList }
constructor TOList.Create;
begin
inherited;
end;
The solution? Changed it to "inherited Create".
constructor TOList.Create;
begin
inherited Create;
end;
Is this a bug? It looks to me like a HUGE one!
I have a class inheriting from TObjectList. In the constructor, it was calling "inherited" and I realized that XE3 doesn't behave like XE. In XE3 "inherited" called the TObject.Create rather than the immediate parent TObjectList.Create, thus not setting FOwnsObjects := True;.
type
TOList = class(TObjectList)
public
constructor Create;
end;
{ TOList }
constructor TOList.Create;
begin
inherited;
end;
The solution? Changed it to "inherited Create".
constructor TOList.Create;
begin
inherited Create;
end;
Is this a bug? It looks to me like a HUGE one!
Agreed. I think the bug was in XE then, it was confusing the old and the new.
ReplyDeleteRegards,
A
The bug is in XE3 because inherited without specifying a name should call the parents method with the same signature (which TObjectList has) but skips it.
ReplyDeleteStefan Glienke I agree.
ReplyDelete