[DUG] TListitems disappearing and reappearing causing access violations
Kyley Harris
Kyley at harrissoftware.com
Tue Apr 9 23:28:54 NZST 2013
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.
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..
1: you haven't said what the list items represent in your app.
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.
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.
we cannot peer review your code without seeing it.
On Tue, Apr 9, 2013 at 11:17 PM, Ross Levis <ross at stationplaylist.com>wrote:
> 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 ****
>
> _______________________________________________
> 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/dd02f9b8/attachment.html
More information about the Delphi
mailing list