Invalid pointer access (the object is not null)

 

Ok I have had it with the error coming up in my EA. I am getting 'invalid pointer access' here is the what happening..

1. before i use any obbject is use

if (CheckPointer(obj)==POINTER_DYNAMIC)||(CheckPointer(obj)==POINTER_AUTOMATIC)

the conditions passes and then I proceed to get the 'invalid pointer access'


i have tried to run this in debug mode from the editor so i can use the add watch variable, i can see the variable is not null


2. all objects being used are created by new and then deleted using delete when they are done.


3. the error is not consistent it seems random, in one instance it runs flawlessly and then seemingly out of nowhere i start to get invalid pointer access, the same code that might be running normally in one chart.

 

try to use it :

if (CheckPointer(obj)== POINTER_INVALID ) {Print("Invalid Pointer "); } 
 
 if you have "invalid pointer access" - error like I had using dynamic object collections - see my answer (GetPointer() needed, though not everywhere)... though I do not know why Not everywhere?..
[MQL4/5] How to save/load/sort dynamic object collections?
[MQL4/5] How to save/load/sort dynamic object collections?
  • 2017.08.09
  • www.mql5.com
I wasn't able to find any documentation on how to override the CObject virtual methods Load, Save, and Compare to make use of(CList and CArrayObj...
Reason: