[DUG] TListitems disappearing and reappearing causing access violations

Ross Levis ross at stationplaylist.com
Tue Apr 9 23:17:17 NZST 2013


The list is populated by the software.  It's still in Delphi 7.

 

No threads are deleting any items.  Only the main thread adds and removes
items.

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.

 

In this particular case, it is in a procedure where one specific listitem is
sent as a parameter.

 

Here are some of the relevant lines of code in the procedure being executed.

 

    if Item <> nil then

    begin

      if Item.Selected then UpdateButtons;

       .

      Item.ImageIndex := 8;

    end;

 

There are no deletions in the procedure.

 

The Item.Selected test works fine but Item.ImageIndex := 8 crashes at
TListItem.SetImage with an access violation.

 

The item existed and then no items exist based on the screen shot.

 

I've been having to put validations all over the place like this.

if ListView.Items.IndexOf(Item) >= 0 then Listitem.ImageIndex := 8.

 

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.

 

It's a nightmare.  I'm wondering if it could be corrupt RAM in the PC or
something.

 

Cheers,

Ross.

 

From: delphi-bounces at listserver.123.net.nz
[mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Kyley Harris
Sent: Tuesday, 9 April 2013 10:33 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] TListitems disappearing and reappearing causing access
violations

 

without seeing the 10lines above, and whats inbetween (if you were being
literal) its very hard to say. 

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. 

what version of delphi is the code now? How does the list get populated or
edited by the application.. 

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)

 

 

On Tue, Apr 9, 2013 at 10:21 PM, Ross Levis <ross at stationplaylist.com>
wrote:

Wondering if anyone has any ideas.

 

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.

 

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.

 

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.

 

Any ideas?

 


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz with
Subject: unsubscribe




-- 
Kyley Harris
Harris Software
+64-21-671-821 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20130409/4f90a55d/attachment-0001.html 


More information about the Delphi mailing list