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(example): workaround to prevent winit crash when unfocused #1323

Merged
merged 2 commits into from
Jul 22, 2024

Conversation

pewsheen
Copy link
Contributor

It's a workaround for issue #1318

Root cause

In Wry, we replace the content view with WryWebViewParent to pass key events to the application menu. When the window is unfocused, winit will call WindowDelegate::window_did_resign_key and get the contentView. It assumes the contentView is WinitView and gets its ivar _state. The ivar does not exist in our WryWebViewParent, so the exception is thrown.

Workaround

WebViewBuilder::new_as_child will not create WryWebViewParent to replace the contentView, so it will be safe to use in winit.

@pewsheen pewsheen requested a review from a team as a code owner July 22, 2024 05:04
Copy link
Contributor

github-actions bot commented Jul 22, 2024

Package Changes Through a182fb6

There are 1 changes which include wry with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
wry 0.41.0 0.42.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@@ -0,0 +1,5 @@
---
"wry": patch
Copy link
Member

Choose a reason for hiding this comment

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

No need for patch if it's example.

@wusyong wusyong merged commit 86faa70 into dev Jul 22, 2024
13 checks passed
@wusyong wusyong deleted the fix/mac-winit-example-crash branch July 22, 2024 05:17
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