Error in simulator using visual studio

Hi everyone, I created an application with some different pages. Pressing the button to go from one page to another sometimes I get this message:


Exception thrown: read access violation.
obj was 0xFFFFFFFFFFFFFFC7.


in this line of code:


       / * If all the children are redrawn make 'post draw' design * /
    obj-> design_cb (obj, & obj_ext_mask, LV_DESIGN_DRAW_POST);

I go from page to page by putting --hidden true–.
In addition, the screen does not randomly load the graphics of all objects.

How is all this possible?
How do errors occur occasionally?

Please provide a code sample that reproduces the issue.

Unfortunately it is a problem because the software is very long :frowning:
In practice I manage three pages, the passage from one page to another takes place with “” lv_obj_set_hidden (page1, state); “”
through a thread.
The software works well but sometimes crashes or the images are not loaded well on the display. The same thing happens both with the simulator and on the hardware.
I believe that the problem is generated above all when I go to delete a particular page, because being rich in objects it takes up a lot of memory, so I delete it to free up space, with the command:
lv_obj_del (menu_setup_page);

The crash happens every now and then, but especially when I delete a particular page. It would seem a problem of time in a particular moment of change of page status.

Thanks for collaboration

Are you using a mutex to guard the interaction between the thread and lv_task_handler?

Honestly I do not know. I simply created threads:

void my_task_handler (void * pvParameter) {

   while (1) {
    vTaskDelay (10);

lv_task_handler ();
}

}

Plus another thread for managing pages. Do I have to set any priority or semaphore?
How does it work and how can I do it?

Take a look at this: https://docs.littlevgl.com/en/html/porting/os.html

The idea is that lv_task_handler can’t be running while another thread is changing internal LittlevGL structures. Something will usually go wrong. For that reason, you should guard calls to lv_task_handler and other LittlevGL APIs with a mutex.

The while loop should lock a mutex, call lv_task_handler, and then unlock that mutex.

Other threads should lock the same mutex, call whatever LittlevGL APIs they wish to use, and unlock the mutex. There shouldn’t be any concern about the thread blocking for an extended period of time because all LittlevGL APIs are non-blocking.

Thanks, I will try at most.

Are these errors always due to the same problem?

Are you using a mutex when these errors occur? If not, please try that and see if the issue persists.

Goodmorning everyone.
Thanks with your advice I managed to solve the problem.
Thanks for collaboration