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 panic when using operations with components in certain cases #1701

Merged
merged 1 commit into from
Feb 14, 2023

Conversation

nicksenger
Copy link
Contributor

Using operations with components nested inside widgets which don't implement operate can cause the application to panic currently. The reason for this is that Component's overlay assumes the element will exist, but we do not perform a diff after processing an operation for a component and rebuilding its element. As a result, components lower in the tree contained within widgets which don't forward operate to their contents will have their element left as None, and thus panic when determining their overlay.

This PR resolves the issue by diffing a component's widget sub-tree after processing an operation and rebuilding its element.

@hecrj hecrj added bug Something isn't working widget labels Feb 14, 2023
@hecrj hecrj added this to the 0.8.0 milestone Feb 14, 2023
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.

We are rebuilding the element but not diffing the tree. This breaks contract. It could also make an operation crash.

Fix makes sense. Thanks! 🎉

@hecrj hecrj merged commit 5b5a5b8 into iced-rs:master Feb 14, 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 widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants