lvgl icon indicating copy to clipboard operation
lvgl copied to clipboard

snapshot question

Open CliffHorse008 opened this issue 1 year ago • 5 comments

LVGL version

v8.3

What happened?

lv_example_snapshot_1.c In this file, each capture will release the cache of the previous capture, but if LVGL enables cache, will there be a memory problem, and whether it should be called here lv_img_cache_invalidate_src when calling lv_snapshot_free

How to reproduce?

static void event_cb(lv_event_t * e) { lv_obj_t * snapshot_obj = lv_event_get_user_data(e); lv_obj_t * img = lv_event_get_target(e);

if(snapshot_obj) {
    lv_img_dsc_t * snapshot = (void *)lv_img_get_src(snapshot_obj);
    if(snapshot) {
        lv_snapshot_free(snapshot);
    }

    /*Update the snapshot, we know parent of object is the container.*/
    snapshot = lv_snapshot_take(img->parent, LV_IMG_CF_TRUE_COLOR_ALPHA);
    if(snapshot == NULL)
        return;
    lv_img_set_src(snapshot_obj, snapshot);
}

}

CliffHorse008 avatar Apr 23 '24 15:04 CliffHorse008

Just to confirm: do you mean each capture should release the cache of the previous capture, but it doesn't happen, therefore the image is not updated?

If so, you are right! I think the cache should be invalidated in lv_snapshot_free. Do you mean the same?

kisvegabor avatar Apr 28 '24 10:04 kisvegabor

yes

CliffHorse008 avatar Apr 29 '24 14:04 CliffHorse008

Great, could you send a Pull request with the fix you have proposed?

kisvegabor avatar May 02 '24 20:05 kisvegabor

We need some feedback on this issue.

Now we mark this as "stale" because there was no activity here for 14 days.

Remove the "stale" label or comment else this will be closed in 7 days.

lvgl-bot avatar May 17 '24 01:05 lvgl-bot

Not stale

kisvegabor avatar May 17 '24 09:05 kisvegabor

I close this issue because there was no activity here for a while.

If you have remarks about this topic feel free to comment here and reopen the issue.

kisvegabor avatar Jun 20 '24 17:06 kisvegabor