Temporary Screen with an infinite loop animation crashes when deleted

After checking the code of lv_anim_del() function in LVGL source-tree, it seems that you can delete (stop) the animation by setting 1st parameter to NULL and giving the executor callback function’s name instead to identify the animation. It isn’t mentioned in LVGL 8.3 documentation, just the cases when you give both the animated variable/object and the function name. But the code shows if any of them is set to NULL the other parameter will be used nevertheless to stop the matching animation.)

So you don’t need to have the animated variable/object ‘PropertyAnimation_0’ (in your latest example ‘ui_MyAnimatedObject’) to be in a global scope, the function name is enough. You can delete (stop) the animation like this before switching from temporary screen to another (tested and works):

lv_anim_del( NULL, (lv_anim_exec_xcb_t) _ui_anim_callback_set_x );

(The 2nd argument - function name - should be rewritten to your actual animator function in your code. The casting is necessary to avoid warnings thrown by lv_anim_del(). )

1 Like