You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use std::shared_ptr but it doesn't seem to be working. Is lvgl not supporting std::shared_ptr?
auto *container=lv_obj_create(lv_screen_active());
lv_obj_set_size(container,200,200);
v_obj_center(container);
lv_obj_set_style_bg_color(container,lv_color_hex(0xffdfba),LV_PART_MAIN);
auto container = std::shared_ptr<lv_obj_t>(lv_obj_create(lv_screen_active()), [](lv_obj_t* obj) {
lv_obj_del(obj); // Custom deleter to handle object deletion
});
lv_obj_set_size(container.get(), 200, 200);
lv_obj_set_style_bg_color(container.get(),lv_color_hex(0xffdfba),LV_PART_MAIN);
The text was updated successfully, but these errors were encountered:
I mostly in C and don't really use C++ or shared pointers, so unfortunately I can't comment much. What I can say is that by design we haven't considered shared pointers specifically. However I can't see why it shouldn't work, once you can pass a custom delete functions.
Can you try with debugger if lv_obj_delete is called?
I want to use std::shared_ptr but it doesn't seem to be working. Is lvgl not supporting std::shared_ptr?
The text was updated successfully, but these errors were encountered: