array out of range in 'CheckGroup.mqh' (164,16)

 

Hi there,

We created a small control panel with check boxes and one button for our EA.

control panel

Generally it is working well and properly but sometimes we experiencing the "array out of range in 'CheckGroup.mqh' (164,16)" error message in the expert tab and the EA stop working. This file is a Metaquotes header file not ours.

The 164th lines in that header file:

m_rows[total-1].Show();

Terminal restart is not solve the problem if we got once it will stay with that chart until it is closed. We have to close the chart and open a new chart for that instrument.

Please help to figure out what would be the problem.

Thanks

 

Crash is in AddItem().

Are you removing objects from the group?

Show code used for adding and removing items.

 

I looked a bit in the CheckGroup code and it looks that there are some potential problems.

For example, it resizes the array that contains check box elements when you create control. Code calculates number of rows that can physically be drawn and that is set as an array size. So, if you add to many items, it could crash with "array out of range" error.

See CCheckGroup::Create() at lines 93 and 106.

 

Please report this issue to the Service Desk of Metaquotes.

Thank you.

 
drazen64:

Crash is in AddItem().

Are you removing objects from the group?

Show code used for adding and removing items.


No, this is a static Control Panel. If we got this error message connected to one of the chart that chart is not working from that point. The other charts are still fine. You have to close the crocked chart, restart the MT4, open a new chart etc.
 

I reread CCheckGroup source again and it looks that there is a mechanism that should prevent "array out of range" error.

It is hard to guess what is happening without your source code.

If you post part of the code where you create that panel and where you add checkbox items, maybe somebody could find cause of the problem.

Reason: