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

Call size_hint from Map #2224

Merged
merged 1 commit into from
Jan 31, 2024
Merged

Call size_hint from Map #2224

merged 1 commit into from
Jan 31, 2024

Conversation

tarkah
Copy link
Member

@tarkah tarkah commented Jan 31, 2024

Default size_hint implementation calls size. This is an issue with the following view, where component is a lazy::Component:

column![
  component.map(..),
]

This resolves to Column::push calling Map::size_hint which calls Component::size during view, and causes a panic because the components internal option state hasn't been set yet, which happens during Widget::state / diff.

@hecrj hecrj added this to the 0.12 milestone Jan 31, 2024
@hecrj hecrj added bug Something isn't working widget fix labels Jan 31, 2024
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Good catch!

I think Explain in the core::element module may have the same issue.

@hecrj hecrj enabled auto-merge January 31, 2024 22:28
@hecrj hecrj merged commit d3727a3 into iced-rs:master Jan 31, 2024
13 checks passed
@tarkah tarkah deleted the fix/map-size-hint branch January 31, 2024 22:38
@tarkah tarkah restored the fix/map-size-hint branch February 8, 2024 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants