A lit late, I guess, but I think I know the flaw in your code. It's with these methods:
> function RawTable: TStrings; > function SortedTable: TStrings; > function DelimitedTable: TStrings; > function HeadersTable: TStrings; Suppose you have this code: var WTParse1: TWTParse; AList:TStrings; begin ... Some initialization AList := WTParse1.RawTable; ... Some more code AList.Free; <---- Your culprit!!! WTParse1.Free; <---- Will AV. end; What happens is that you're probably freeing those stringlists a bit too often. Not a good thing to do. It would be better if you use a different method to return these stringlists to your application. E.g. like this: function TWTParse.RawTable: TStrings; begin Result := TStringList.Create; Result.Text := FRawTable.Text; end; What this does is simple. It will generate copies of the stringlists in your component. That will allow you to free them again after you're done with them, and it won't AV in the destructor. A second solution would be this: function TWTParse.RawTable: string; begin Result := FRawTable.Text; end; Now the result is just a string. Which you can manage as a string in your application or assign you your own stringlist. With Delphi, it is pretty important to keep track of when you allocate memory and when you free it again. A stringlist is a class and when you send it over to other functions, you're just sending over pointers to this class. And when you free the class anywhere in your code and another function then tries to call it, well... That would result in a big, fat AV... With kind regards, X Katja Bergman. --- In [email protected], logman0u812 <[EMAIL PROTECTED]> wrote: > hey all, > Im new to creating components, and Im having a problem > getting rid of an error in one of my components. The > exception is an EAccessViolation whenever I quit my > test application that used one my components. And I > know it has to do with the TStrings that Im using > inside the component. Im freeing the TStrings when the > component is destroyed but the error still persists. > > here is some code from the parsing component: > > TWTParse = class(TComponent) > private > FRowCount: integer; > FCellCount: integer; > FHeadersCount: integer; > FRemoveHeaders: boolean; > FRawTable : TStrings; > FSortedTable: TStrings; > FDelimitedTable: TStrings; > FTableHeaders: TStrings; > FCellDelimiter: char; > FRowDelimiter: char; > // etc ....... > protected > procedure SetRawTable(newValue: TStrings); > virtual; > function GetRawTable: TStrings; virtual; > procedure SetCellDelimiter(newValue: char); > virtual; > procedure SetRowDelimiter(newValue: char); > virtual; > public > constructor Create(AOwner: TComponent); override; > destructor Destroy; override; > procedure ParseData; > procedure ThreadParseData; > function Execute: Boolean; > function TableRowCount: Integer; > function TableCellCount: Integer; > function TableHeadersCount: Integer; > function RawTable: TStrings; > function SortedTable: TStrings; > function DelimitedTable: TStrings; > function HeadersTable: TStrings; > function SortTable(tstr: TStrings): TStrings; > published > property CellDelimiter: char read FCellDelimiter > write SetCellDelimiter default #127; > property RowDelimiter: char read FRowDelimiter > write SetRowDelimiter default #127; > property RemoveHeaders: boolean read > FRemoveHeaders write FRemoveHeaders default true; > property Data: TStrings read GetRawTable write > SetRawTable; > // - events etc... > end; > > > constructor TWTParse.Create(AOwner: TComponent); > begin > inherited Create(aOwner); > FSortedTable := TStringlist.Create; > FRawTable := TStringlist.Create; > FDelimitedTable := TStringlist.Create; > FTableHeaders := TStringlist.Create; > FTableRowCount := 0; > FTableCellCount := 0; > end; > > destructor TWTParse.Destroy; > begin > FDelimitedTable.Free; > FRawTable.Free; > FSortedTable.Free; > FTableHeaders.Free; > > inherited Destroy; > end; > > > I know Im probably missing something simple, so can > someone please open my eyes :) > Thank you for your time.... > > Frank > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

