[fpc-pascal]TCollection.Add
Taj Morton
taj at wildgardenseed.com
Wed Apr 21 19:54:53 CEST 2004
Hello Everybody,
I must be missing something...donno. Whenever I try to add an item to a
TCollection, it errors out.
function TDepsList.Add(const Name: string; VerOperator: TVerOper;
Version:String): TDepsItem;
begin
Result := inherited Add as TDepsItem; <-- Crashes here
Result.SetName(Name);
Result.SetVersionOperator(VerOperator);
Result.SetVersion(Version);
end;
Definition of TDepsItem:
TDepsItem = class(TCollectionItem)
private
FName: String;
FVersion: String;
FVerOperator: TVerOper;
procedure SetName(Value: String);
procedure SetVersion(Value: String);
procedure SetVersionOperator(Value: TVerOper);
public
property Name: string read FName write SetName;
property Version: string read FVersion write SetVersion;
property VersionOperator: TVerOper read FVerOperator write
SetVersionOperator;
end;
It errors with:
An unhandled exception occurred at 0x08053357 :
EACCESSVIOLATION : Access violation
0x08053357
0x08060686 TDEPSLIST__ADD, line 178 of package.pp
0x0806138B TPACKAGE__READDEPS, line 353 of package.pp
0x6F76003B
Segmentation fault
Any ideas why?
Thanks,
--
Taj
"Never memorize something that you can look up."
--Albert Einstein
More information about the fpc-pascal
mailing list