Closed khanhas closed 3 years ago
Thanks, indeed I shouldn't use pointers (or iterators btw they just wrap the pointer). Reserving the keys would work, but I'll just store indices and add helper functions to get a key reference.
Can you test the latest master, I now store indices instead of pointers. (you can get a compiled build here)
Good work. I saw no segfault during10m playing around with it.
Fixed by bcc2487cf90803c54c8b08b42522b8079f38d230
First of all, great work on porting yaft to reMarkable. It's so light and fast, keyboard works with 0 visual delay and I love it so much!
So I tried to add more keys on another row to the list. Unfortunately, a bug consistently happened that Ctrl, shift and alt are always on. It led to invalid key and Segmentation fault all the time whenever I hit something (except ctrl, shift and alt tho). After a "few" hours investigating, the bug is due to you using addresses of elements in
vector<Key> keys
forshiftKey
,ctrlKey
andaltKey
. These addresses are potentially changed after emplacing more elements to thevector
.Unless vector are reserved enough memory space prior any emplacing operation, vector would reallocate all elements to new space. To prevent bugs in the future, you can either:
Or use
std::vector<Key>::iterator
instead of address.