lvgl / lv_drivers

TFT and touch pad drivers for LVGL embedded GUI library
https://docs.lvgl.io/master/porting/index.html
MIT License
290 stars 309 forks source link

fix(xkb): Fix memory leak by avoiding double reference #276

Closed Johennes closed 1 year ago

Johennes commented 1 year ago

This leak was reported by Valgrind in unl0kr (see https://gitlab.com/cherrypicker/unl0kr/-/issues/43). It turns out that xkb_keymap_new and xkb_state_new return referenced instances. So the extra calls to xkb_keymap_ref and xkb_state_ref were not needed and caused the memory to not be properly cleaned up in xkb_deinit_state.

Apologies for introducing this bug together with the original XKB work in lv_drivers. I was mistakenly assuming this was the correct way to use the API because the libinput API worked this way.

kisvegabor commented 1 year ago

Thanks for the fix! :+1:

kisvegabor commented 1 year ago

BTW, now LVGL master has the new architecture and we can add the drivers from this repo. This way we'd have a lot of drivers in a central place, and they would be versioned and maintained together.

You you be interested in contributing by moving this driver to LVGL master? Here is a summary about the changes.

Johennes commented 1 year ago

BTW, now LVGL master has the new architecture and we can add the drivers from this repo. This way we'd have a lot of drivers in a central place, and they would be versioned and maintained together.

You you be interested in contributing by moving this driver to LVGL master? Here is a summary about the changes

Oh, great! Having them in a single repository would also make the packaging a bit easier for us. We're currently investigating keys being dropped when typing too fast with the current libinput driver (https://gitlab.com/cherrypicker/unl0kr/-/issues/36). Looks like switching to the new driver architecture on LVGL master would be a good next step before we dive deeper into this. :+1:

kisvegabor commented 1 year ago

Happy to hear that you are interested in it! :relaxed:

Let me know when you'd like to jump into it and need some assistance.