Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segfault on certain buffer sizes #86

Merged
merged 1 commit into from
Apr 1, 2023
Merged

Fix segfault on certain buffer sizes #86

merged 1 commit into from
Apr 1, 2023

Conversation

nia-e
Copy link
Collaborator

@nia-e nia-e commented Apr 1, 2023

This was a lovely (awful) issue to fix, and was actually the core issue underpinning #74. When implementing the lv_disp_t, the LVGL docs specify that the driver object must be the first member of the struct. In #67 I changed the struct we have here to also hold the buffer, as this simplified both the API and the internal logic. However, I was not aware of the requirement re: struct layout, and Rust doesn't actually guarantee any specific type layout; so, on certain buffer sizes, the compiler was putting the buffer before the driver.

On the bright side, all this segfault chasing has quadrupled my productivity with lldb.

@nia-e nia-e merged commit b28bfdb into master Apr 1, 2023
@nia-e nia-e deleted the cursed-structs branch April 1, 2023 23:22
@rafaelcaricio
Copy link
Collaborator

I need to step up my game and learn how to use lldb 😅

@nia-e
Copy link
Collaborator Author

nia-e commented Apr 2, 2023

It's so painful yet so worth it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants