[DUG] Rare access violations reading listitem.subitems
Maurice Butler
likemagic at quicksilver.net.nz
Sat Aug 11 22:07:14 NZST 2007
Bad memory? - try memtest86+ http://www.memtest.org/
Maurice
-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of Ross Levis
Sent: Saturday, 11 August 2007 6:02 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: [DUG] Rare access violations reading listitem.subitems
I have one user of my software which is experiencing an occasional access
violation in a routine which is simply reading some data stored in a
ListView. The items in the listview are static and not changing at the
time. There are always 5 columns of data, the Caption, and 4 SubItems.
The function simply replaces some parameters in a user formatted string with
data as follows.
Result := StringReplace(Result,'%a',Item.Caption,[rfReplaceAll]);
Result := StringReplace(Result,'%t',Item.SubItems[0],[rfReplaceAll]);
Result := StringReplace(Result,'%s',Item.SubItems[1],[rfReplaceAll]);
Result := StringReplace(Result,'%c',Item.Subitems[3],[rfReplaceAll]);
Not very efficient but nevermind.
The first line always works. Item.Caption gets replaced correctly every
time and never crashes. If an Access Violation occurs, it's usually on the
2nd line, but sometimes this also works, and the crash occurs on the 3rd
line. I've not seen a crash on the 4th line.
The items were loaded at least 20 minutes prior to this function being
called, so it's not a matter of the ListItem being deleted or created at the
same time.
It's completely beyond me. Are there any known issues with ListViews in
Delphi 7, or any other ideas?
Thanks,
Ross.
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe
More information about the Delphi
mailing list