<div dir="ltr"><div><div><div><div>Unless you are willing to show a sample of code with a bit more depth than that, then no-one can really help you. I would imagine corrupt ram is not the issue, otherwise all applications, and the operating system would show faults, including corrupt page writes to the HDD. <br>
<br></div>you say there are no deletions in the procedure.. but I'm assuming the code ... contains method calls and other things just like the update buttons which could be working with actions etc..<br><br></div>1: you haven't said what the list items represent in your app.<br>
</div>2: we dont know why you are passing a list item to a function, rather than the list item index and then access it by index and test each time. <br><br></div>if this is a procedure.. and there are no threads, and the listitem existed at the start, but does not at the end.. then you are deleting it somehow even if you dont realise how.<br>
<div><div><div><div><div><br></div><div>we cannot peer review your code without seeing it.<br></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 9, 2013 at 11:17 PM, Ross Levis <span dir="ltr"><<a href="mailto:ross@stationplaylist.com" target="_blank">ross@stationplaylist.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-NZ"><div><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">The list is populated by the software. It’s still in Delphi 7.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">No threads are deleting any items. Only the main thread adds and removes items.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"> <u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">There is no one procedure this has occurred in. It can work for 2 days and suddenly this happens in a random procedure that accesses a list item.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">In this particular case, it is in a procedure where one specific listitem is sent as a parameter.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">Here are some of the relevant lines of code in the procedure being executed.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"> if Item <> nil then<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"> begin<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"> if Item.Selected then UpdateButtons;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"> …<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"> Item.ImageIndex := 8;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"> end;<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">There are no deletions in the procedure.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">The Item.Selected test works fine but Item.ImageIndex := 8 crashes at TListItem.SetImage with an access violation.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">The item existed and then no items exist based on the screen shot.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">I’ve been having to put validations all over the place like this…<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">if ListView.Items.IndexOf(Item) >= 0 then Listitem.ImageIndex := 8.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">This user has had a crash where it does this validation up the procedure somewhere which validated, but further down it will be accessing Item.Index and this crashes.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">It’s a nightmare. I’m wondering if it could be corrupt RAM in the PC or something.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">Cheers,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d">Ross.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" lang="EN-US">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" lang="EN-US"> <a href="mailto:delphi-bounces@listserver.123.net.nz" target="_blank">delphi-bounces@listserver.123.net.nz</a> [mailto:<a href="mailto:delphi-bounces@listserver.123.net.nz" target="_blank">delphi-bounces@listserver.123.net.nz</a>] <b>On Behalf Of </b>Kyley Harris<br>
<b>Sent:</b> Tuesday, 9 April 2013 10:33 p.m.<br><b>To:</b> NZ Borland Developers Group - Delphi List<br><b>Subject:</b> Re: [DUG] TListitems disappearing and reappearing causing access violations<u></u><u></u></span></p>
</div><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><div><div><div><p class="MsoNormal" style="margin-bottom:12.0pt">without seeing the 10lines above, and whats inbetween (if you were being literal) its very hard to say. <u></u><u></u></p>
</div><p class="MsoNormal" style="margin-bottom:12.0pt">The only time I've ever had something dissapear from a list is when I deleted it though a callback, method, thread etc.. or freeing something. <u></u><u></u></p>
</div><p class="MsoNormal" style="margin-bottom:12.0pt">what version of delphi is the code now? How does the list get populated or edited by the application.. <u></u><u></u></p></div><p class="MsoNormal">I'd start by looking at how many locations of code insert or delete the list items, and verify none are being called while your procedure is executing its for-loop, (assuming the access violation is an index based one because of the list count change)<u></u><u></u></p>
<div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p><div><p class="MsoNormal">On Tue, Apr 9, 2013 at 10:21 PM, Ross Levis <<a href="mailto:ross@stationplaylist.com" target="_blank">ross@stationplaylist.com</a>> wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal"><span style="color:#1f497d">Wondering if anyone has any ideas.</span><u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d">I've had this problem a long time from when I started writing an app about 7 or 8 years ago, but it happens so rarely it's not usually an issue. But one user in particularly is regularly sending me MadExcept reports which either have access violation errors or "the application appears to be frozen". In all cases it's during an access of a TListItem which was perfectly valid 10 lines of code up a procedure but suddenly doesn't exist.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d">The screenshot created at the same time shows the ListView has no visible items, but I know for a fact there are 30 or more items in the list. I believe sometimes the items visually disappear and reappear shortly afterwards, like a Desktop refresh.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d">I think I've heard something about Windows recreating the window handles or some such thing. I don't understand why it would do so. There are no changes to the listview that would require re-creating the window.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d">Any ideas?</span><u></u><u></u></p><p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p>
</div></div><p class="MsoNormal"><br>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<u></u><u></u></p>
</div><p class="MsoNormal"><br><br clear="all"><br>-- <br>Kyley Harris<br>Harris Software<br>+64-21-671-821 <u></u><u></u></p></div></div></div></div></div><br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br><br clear="all"><br>-- <br>Kyley Harris<br>
Harris Software<br>+64-21-671-821
</div></div>