voorkant / voorkant-core

https://voorkant.org/
MIT License
2 stars 3 forks source link

WIP: first stab at lvobj memory management #65

Open Habbie opened 4 months ago

Habbie commented 4 months ago

good news: it looks like we can add this automatic destructor without changing any .cpp

bad news: https://docs.lvgl.io/8.0/overview/object.html says:

There is a common delete function for all object types. It deletes the object and all of its children.

I think this means we need to delete children before we delete parents, and I think this means we should represent LVGL object hierarchy as C++ object hierarchy (which, to be fair, is desirable for a lot of reasons).

Habbie commented 4 months ago

the destructor should probably take g_lvgl_updatelock, as should our construction (which we currently get away with because we construct everything before we start ticking)

Habbie commented 1 month ago

I think this means we need to delete children before we delete parents, and I think this means we should represent LVGL object hierarchy as C++ object hierarchy (which, to be fair, is desirable for a lot of reasons).

via @cyclops1982 in https://github.com/voorkant/voorkant-core/pull/68#discussion_r1538110625 (and discussed in similar ways on IRC):

"it is okay if only LVGL owns a pointer to this, we currently believe that LVGL will free the object when it is cleaning up the parent"