<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Ross,<br>
<br>
Have you perhaps thought that you have approached this in the wrong
way?<br>
It is clearly a mistake to maintain a list of TListItems external to
the TListView control. I believe you would be better off
maintaining your list of objects/records with the appropriate
structure, and then dynamically fill the TListView based on that
information.<br>
<br>
Check the help about virtual list views and the OnData event.<br>
<br>
Regards,<br>
<br>
Bevan<br>
<br>
<br>
<div class="moz-cite-prefix">On 11/04/2013 3:52 p.m., Ross Levis
wrote:<br>
</div>
<blockquote cite="mid:00fb01ce3668$013dd050$03b970f0$@com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 3 0 0 0 0 0 0 0;}
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 3 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@PMingLiU";
        panose-1:2 2 3 0 0 0 0 0 0 0;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle24
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Yes
I realize that, but I didn’t know that was possible with
TListItems which the VCL manages for you. I need to know
what situations will cause that. I really need access to
all the items in the listview immediately at any time. The
app will not run correctly if something is freeing list
items willy nilly.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Presumably
a RecreateWnd() is being executed on the ListView for some
reason other than any code in the software. I’ve checked
the VCL source code for TCustomListView and where
RecreateWnd is being executed, and it’s only with a change
to a handful of Properties which I am not altering in code.
So Windows is doing this itself for some reason.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">I
think I will have to subclass the TListView's WindowProc
property to look for CM_RECREATEWND and WM_DESTROY messages,
and stop all processing until this is finished. Hopefully
that will sort it out. What a bloody hassle.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Ross.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">
<o:p></o:p></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";color:windowtext"
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
[<a class="moz-txt-link-freetext" href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>] <b>On
Behalf Of </b>Todd Martin<br>
<b>Sent:</b> Thursday, 11 April 2013 10:04 a.m.<br>
<b>To:</b> NZ Borland Developers Group - Delphi List<br>
<b>Subject:</b> Re: [DUG] TListitems disappearing and
reappearing causing access violations<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Ross<br>
<br>
Clearly the problem is NOT that the items are being removed
from the list. Rather the items are being freed, (from
previous comments) in various places, yet not removed. <br>
<br>
Just because <span
style="font-family:"Calibri","sans-serif"">assigned(PlayView.Items[i])
is true, does not mean that that instance exists. It means
that the object pointer is not nil. Do you understand the
difference between a nil pointer and a pointer to memory
that is no longer in use?<br>
<br>
Todd.<br>
<br>
<br>
<br>
</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">I’ve
heard today that TeamViewer isn’t in use when the problem
occurs. They often use it to resolve the issue after the
problem has occurred.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">They
tell me they have seen it in mid-song where all the tracks
disappear and the app then becomes unresponsive or crashes
because of the app still accessing items that don’t exist.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">There
are no deletion routines in the program which delete every
item from the listview, so that’s not what’s going on.
Considering there are around 5000 users who have no problems
at all, I don’t think it can be a coding problem. There has
been the very rare issue like this reported over the years
but this one user is getting it regularly, like every couple
of days.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">I
thought I was on to something with remote control app but it
appears not. </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">Another
reported crash a couple of weeks ago was here…</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">i
:= Item.Index;</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">while
(i < PlayView.Items.Count) and (PlayView.Items[i].Caption
= EventTimeStr) do</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">…</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">The
“while” line crashed with Access Violation in
ComCtrls.TListItems.GetItem, and the screen shot again
showed no items. This should prove that it cannot be the
software removing the items as otherwise Items.Count would
be 0.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">Someone
else with dual monitors had a crash on the same line about 6
months ago and it has now been modified to validate items[i]
is a real item before retrieving the caption. This will
stop the error but the software will not function correctly.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">Cheers.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif""> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid windowtext
1.0pt;padding:3.0pt 0cm 0cm
0cm;border-color:-moz-use-text-color -moz-use-text-color">
<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 moz-do-not-send="true"
href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
[<a moz-do-not-send="true"
href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>]
<b>On Behalf Of </b>Ross Levis<br>
<b>Sent:</b> Wednesday, 10 April 2013 2:38 a.m.<br>
<b>To:</b> 'NZ Borland Developers Group - Delphi List'<br>
<b>Subject:</b> Re: [DUG] TListitems disappearing and
reappearing causing access violations</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif"">I
guess I am. It makes the most sense. I’ll have to try a
test with TeamViewer to duplicate it.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif""> </span><o:p></o:p></p>
<div style="border:none;border-top:solid windowtext
1.0pt;padding:3.0pt 0cm 0cm 0cm;border-color:rgb(181,
196,
223) -moz-use-text-color -moz-use-text-color">
<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 moz-do-not-send="true"
href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
[<a moz-do-not-send="true"
href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>]
<b>On Behalf Of </b>Kyley Harris<br>
<b>Sent:</b> Wednesday, 10 April 2013 12:48 a.m.<br>
<b>To:</b> NZ Borland Developers Group - Delphi List<br>
<b>Subject:</b> Re: [DUG] TListitems disappearing and
reappearing causing access violations</span><o:p></o:p></p>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I think
the problem is that right now you are running on the
Theory that they are being reconstructed as you state, and
you have not created a test scenario to validate what you
are saying. <o:p></o:p></p>
</div>
<p class="MsoNormal">it could just be a coding error, and the
delete event will tell you when a list item is being
destroyed. That list item will not be destroyed if the
window handle is reconstructed. Not in the source code I can
see.,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
<div>
<p class="MsoNormal">On Wed, Apr 10, 2013 at 12:41 AM, Ross
Levis <<a moz-do-not-send="true"
href="mailto:ross@stationplaylist.com" target="_blank">ross@stationplaylist.com</a>>
wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Actually
that doesn’t help so much. I really need to know
when Windows is deleting the items. My app also
deletes items. I guess I could remove the
OnDeletion event property before coding a delete and
reinstate if afterwards. A little messy.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">I
really need to associate the individual deleted
items with the identical new items that will be
created just afterwards. Ideally I would want my
app to stop processing all timers and functions
while the deletions and recreations are done.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Getting
too complicated.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid windowtext
1.0pt;padding:3.0pt 0cm 0cm
0cm;border-color:-moz-use-text-color
-moz-use-text-color">
<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 moz-do-not-send="true"
href="mailto:delphi-bounces@listserver.123.net.nz"
target="_blank">delphi-bounces@listserver.123.net.nz</a>
[mailto:<a moz-do-not-send="true"
href="mailto:delphi-bounces@listserver.123.net.nz"
target="_blank">delphi-bounces@listserver.123.net.nz</a>]
<b>On Behalf Of </b>Kyley Harris</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><br>
<b>Sent:</b> Wednesday, 10 April 2013 12:06 a.m.<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><b>To:</b> NZ Borland
Developers Group - Delphi List<br>
<b>Subject:</b> Re: [DUG] TListitems
disappearing and reappearing causing access
violations<o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal">the listview has an
Ondeletion event. when that fires, you should
check the index, and remove any listitem
references from your tlist. <br>
<br>
The issue seems to be that you are mixing view
objects with data objects. the system might go
more smoothly if you were containing your data
objects disctinct from your view (tlistview) and
synchronizing the view to the source. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
<div>
<p class="MsoNormal">On Tue, Apr 9, 2013 at
11:58 PM, Ross Levis <<a
moz-do-not-send="true"
href="mailto:ross@stationplaylist.com"
target="_blank">ross@stationplaylist.com</a>>
wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">It
isn’t a user initiated procedure. It’s
a broadcast media player in automation
mode and each track is a listitem.
Items can be dropped off the top and
more added to the bottom as it plays
automated.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">There
is a TTimer which accesses all the items
in the list once a second to provide
totals and such. So the items are
accessed very regularly.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Some
of the list items are timed events which
need to occur at a specific time. These
item pointers are stored in a TList so
the software can easily access the next
one without having to look for it in the
list.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">This
user has had issues with the code that
accesses this TList of TListitem
pointers, so that sounds like the
pointers to the listitems have been
changed.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Ideally
the listitems shouldn’t be accessed
directly and a separate data store
should be used that is linked to each
item via the Data property. A bit too
late for that now though.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">So
it sounds like I need to find the
Windows message that is being sent to
the app to recreate windows and do some
housekeeping.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Any
ideas what that might be?</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid
windowtext 1.0pt;padding:3.0pt 0cm 0cm
0cm;border-color:-moz-use-text-color
-moz-use-text-color">
<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
moz-do-not-send="true"
href="mailto:delphi-bounces@listserver.123.net.nz"
target="_blank">delphi-bounces@listserver.123.net.nz</a>
[mailto:<a moz-do-not-send="true"
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
11:35 p.m.</span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><br>
<b>To:</b> NZ Borland Developers
Group - Delphi List<br>
<b>Subject:</b> Re: [DUG] TListitems
disappearing and reappearing causing
access violations<o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt">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. <o:p></o:p></p>
</div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt"> <o:p></o:p></p>
<div>
<p class="MsoNormal">On Tue, Apr 9,
2013 at 11:29 PM, Ross Levis <<a
moz-do-not-send="true"
href="mailto:ross@stationplaylist.com"
target="_blank">ross@stationplaylist.com</a>>
wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">I’ve
had someone suggest this
elsewhere…</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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.</span></i><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Ross.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div>
<div
style="border:none;border-top:solid
windowtext
1.0pt;padding:3.0pt 0cm 0cm
0cm;border-color:rgb(181,
196, 223)
-moz-use-text-color
-moz-use-text-color">
<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
moz-do-not-send="true"
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</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">
if Item <> nil then</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">
begin</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> if
Item.Selected then
UpdateButtons;</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">
…</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> Item.ImageIndex
:= 8;</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">
end;</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">There
are no deletions in the
procedure.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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…</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">if
ListView.Items.IndexOf(Item)
>= 0 then
Listitem.ImageIndex := 8.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Cheers,</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Ross.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div
style="border:none;border-top:solid
windowtext
1.0pt;padding:3.0pt 0cm 0cm
0cm;border-color:rgb(181,
196, 223)
-moz-use-text-color
-moz-use-text-color">
<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
moz-do-not-send="true"
href="mailto:delphi-bounces@listserver.123.net.nz" target="_blank">delphi-bounces@listserver.123.net.nz</a>
[<a
moz-do-not-send="true"
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</span><o:p></o:p></p>
</div>
<p class="MsoNormal"> <o:p></o:p></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. <o:p></o:p></p>
</div>
<div>
<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. <o:p></o:p></p>
</div>
</div>
</div>
<div>
<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.. <o:p></o:p></p>
</div>
</div>
</div>
<div>
<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)<o:p></o:p></p>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt"> <o:p></o:p></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt"> <o:p></o:p></p>
<div>
<p class="MsoNormal">On
Tue, Apr 9, 2013 at
10:21 PM, Ross Levis
<<a
moz-do-not-send="true"
href="mailto:ross@stationplaylist.com" target="_blank">ross@stationplaylist.com</a>>
wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">Wondering
if anyone has any
ideas.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Any
ideas?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><br>
_______________________________________________<br>
NZ Borland Developers
Group - Delphi mailing
list<br>
Post: <a
moz-do-not-send="true"
href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a><br>
Admin: <a
moz-do-not-send="true"
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
moz-do-not-send="true"
href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a>
with Subject:
unsubscribe<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <br>
Kyley Harris<br>
Harris Software<br>
+64-21-671-821 <o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><br>
_______________________________________________<br>
NZ Borland Developers Group -
Delphi mailing list<br>
Post: <a moz-do-not-send="true"
href="mailto:delphi@listserver.123.net.nz"
target="_blank">delphi@listserver.123.net.nz</a><br>
Admin: <a moz-do-not-send="true"
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
moz-do-not-send="true"
href="mailto:delphi-request@listserver.123.net.nz"
target="_blank">delphi-request@listserver.123.net.nz</a>
with Subject: unsubscribe<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <br>
Kyley Harris<br>
Harris Software<br>
+64-21-671-821 <o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing
list<br>
Post: <a moz-do-not-send="true"
href="mailto:delphi@listserver.123.net.nz"
target="_blank">delphi@listserver.123.net.nz</a><br>
Admin: <a moz-do-not-send="true"
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
moz-do-not-send="true"
href="mailto:delphi-request@listserver.123.net.nz"
target="_blank">delphi-request@listserver.123.net.nz</a>
with Subject: unsubscribe<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <br>
Kyley Harris<br>
Harris Software<br>
+64-21-671-821 <o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a moz-do-not-send="true"
href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a>
with Subject: unsubscribe<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <br>
Kyley Harris<br>
Harris Software<br>
+64-21-671-821 <o:p></o:p></p>
</div>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>NZ Borland Developers Group - Delphi mailing list<o:p></o:p></pre>
<pre>Post: <a moz-do-not-send="true" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><o:p></o:p></pre>
<pre>Admin: <a moz-do-not-send="true" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><o:p></o:p></pre>
<pre>Unsubscribe: send an email to <a moz-do-not-send="true" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<o:p></o:p></pre>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">-- <br>
<i>Fortune</i> favours the <b>brave</b><o:p></o:p></p>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</pre>
</blockquote>
<br>
</body>
</html>