How can I delete all animations before a screen closes?

Description

Sometimes LVGL crashes when a screen is destroyed while objects on the screen are still animating. I’d like to try calling lv_anim_del_all() on LV_EVENT_SCREEN_UNLOAD_START, just before the new screen starts loading. Is it possible to hook this event globally for all screens?

Or, if this is a bad approach, could you suggest another?

What MCU/Processor/Board and compiler are you using?

ESP32-S3, custom board, GCC12.x

What LVGL version are you using?

8.4.0.

What do you want to achieve?

I’d like to ensure animations are safely destroyed before their screen/object targets are destroyed.

What have you tried so far?

I’ve tried calling lv_anim_del(NULL, func) on LV_EVENT_SCREEN_UNLOAD_START, and it seems to help, but it’s a burden to register a screen destructor for every screen.

Partial solution: register a feedback_cb() to all input devices to call lv_anim_del(NULL, NULL) on every LV_EVENT_SCREEN_UNLOAD_START, but this only works if all animations are on temporary screen - any animations on permanent screens are deleted as well :frowning: