Gajo In this situation I usually find that one of the calls to this procedure is referring to an non-instantiated class. Since "list" is not Nil (address $20) adding an Assigned() test isn't going to help.
I suspect that there may be ambiguity in some part of the call structure. Questions: Is "list" a unit variable, global variable or a field in the class? Is the procedure a class method, a unit procedure or a global procedure? Is the application threaded? Is the procedure called directly or through a reference in another structure? Is it possible that the class containing "list" is substantiated more than once? Stephen ----- Original Message ----- From: "gajo" <[EMAIL PROTECTED]> To: "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]> Sent: Saturday, October 30, 2004 5:11 AM Subject: [DUG] I get an EAccessViolation for some reason > Hello, > > I have an awkward error. This is the error message that I get: > > Project MyProject.exe raised exception class EAccessViolation with message > 'Access violation at address 0044C169 in module 'MyProject.exe'. Read of > address 00000020'. Process stopped. Use Step or Run to continuue. > > I have an object which contains a TObjectList, which contains some objects. > I have a procedure which goes like this: > > begin > if list.Count > 0 then begin > // do stuff > end > end; > > For some reason, the exception always happens at the list.count > 0 line. > There are no errors in the code itself, and the procedure works fine when > called a couple of times. The problem could be in the fact that the > procedure is called many times from many other procedures, and perhaps they > are trying to access the items of the list at the same time? Could this be > possible, considering that I'm not using threads? Perhaps some internal > procedures are threaded without my knowledge, and some procedure can't > finish its work on time, and another thread wants to access a memory block > that this thread is using? > > There is no way for me to bypass the exception, even if I put it in a 'try' > block, and write that on Exception do nothing. During execution there's > going to be an error message sooner or later, even though I explicitly made > it so that there would be no messages whatsoever. > > The rest of the program seems to function just fine. I get the error > message, click on OK and it goes on as if nothing has happened, then a few > seconds later I get another error. Has this got something to do with Windows > XP? > > What should I do? > > Gajo > > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] > http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
