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

Eliminate UB around move semantics in display logic #75

Merged
merged 1 commit into from
Mar 27, 2023
Merged

Eliminate UB around move semantics in display logic #75

merged 1 commit into from
Mar 27, 2023

Conversation

nia-e
Copy link
Collaborator

@nia-e nia-e commented Mar 27, 2023

The dereferencing of disp_drv in display.rs:330 would lead to a move and set everything behind the old pointer to null. Simply moving back before the pointer is reused fixes this.

This took at least 4 hours for me to figure out. I hate pointers.

@nia-e nia-e added the bug Something isn't working label Mar 27, 2023
@nia-e nia-e merged commit 13a54a2 into lvgl:master Mar 27, 2023
@rafaelcaricio
Copy link
Collaborator

Maybe we could also change the deref be ‘&mut’ instead of a owned value, then the value is not going to be dropped and we don’t need to assign it back?

@nia-e
Copy link
Collaborator Author

nia-e commented Mar 27, 2023

That should work too and would probably be cleaner, good point. I'll try that out and probably bundle that into #76

This was referenced Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants