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

UI: Replace generic parameters with ScrollableWidget #598

Merged
merged 1 commit into from
Mar 2, 2025

Conversation

mike-ward
Copy link
Contributor

Many of the examples in examples/ (e.g. demo_scrollview.v) will immediately fault when compiled with the -prod flag. I've also seen similar faults in my own project, github/mike-ward/Kite. I found that the faults consistently occurred in functions that used generic parameters in Interface_Scrollable.v.

Using a debugger and some printf statements, I determined that pointers in these methods were sometimes corrupt, although I could never deduce why. The corruptions only occurred when building with the -prod flag.

I noticed that the functions in question could have their generic parameters replaced with ScrollableWidget. After making this change, most of the example programs no longer faulted when built with the -prod flag. A few examples, notably, examples\layout\dynamic_layout.v will fault when interacted with. I plan to investigate this later.

I also took the opportunity to remove some redundant checks for has_scrollview() in said functions.

While this issue in not definitive, there is cause to think an issue with generic parameters and -prod may be lurking in V.

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.
More concrete code is easier to maintain and debug too,
and it seems that the genericity was not used.

@spytheman spytheman merged commit 13eaf09 into vlang:master Mar 2, 2025
8 checks passed
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