<div dir="ltr"><div>If that was the case.. then its unlikely to happen midstream during a very small short procedure call. Especially if that procedure call is a user initiated one. <br><br></div>if that is the case.. its extremely simple to test this with remote desktop and some logging of the construction/destruction of the list items.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 9, 2013 at 11:29 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">I’ve had someone suggest this elsewhere…<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"><i><span style="font-family:"Calibri","sans-serif"">The user connects a monitor to a laptop, or connects remotely via <br>
terminal services.<br>Basically, anything that changes the display resolution has that kind of <br>consequences.<u></u><u></u></span></i></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 have seen a TeamViewer in one of the many screen shots. So I guess Windows is recreating the windows and allocating new handles to the list items as I thought. I’ll check with them if the crashes coincide with use of TeamViewer.<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">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><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"> Ross Levis [mailto:<a href="mailto:ross@stationplaylist.com" target="_blank">ross@stationplaylist.com</a>] <br>
<b>Sent:</b> Tuesday, 9 April 2013 11:17 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="im"><p class="MsoNormal"><u></u> <u></u></p><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> [<a href="mailto:delphi-bounces@listserver.123.net.nz" target="_blank">mailto: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><p class="MsoNormal"><u></u> <u></u></p></div><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><div><div class="h5"><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></div></div><div><div class="h5"><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></div>
</div><div><div class="h5"><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></div><div><div class="h5"><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>