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(macOS): race conditions around WKURLSchemeTask #1484

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

alexmoon
Copy link

@alexmoon alexmoon commented Feb 10, 2025

Fixes two issues which could cause race conditions when navigating between pages while custom protocol requests are in progress on macOS and iOS:

  • The obc2/catch-all feature turns all Objective-C exceptions into panics, preventing obc2::exception::catch(...) from working.
  • The webview and task objects passed to start_task were not retained, leading to use-after-free issues in the responder.
  • WryWebView::remove_custom_task_key is called from both stop_task and response which may be in different threads, so custom_protocol_task_ids needs to be protected by a Mutex.

Closes #1189

@alexmoon alexmoon requested a review from a team as a code owner February 10, 2025 20:40
@alexmoon alexmoon force-pushed the wkurlschemetask-crash branch 2 times, most recently from 8f7644e to 2139170 Compare February 10, 2025 20:42
Copy link
Contributor

github-actions bot commented Feb 10, 2025

Package Changes Through 210a651

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.48.1 0.49.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

@alexmoon alexmoon force-pushed the wkurlschemetask-crash branch from 2139170 to 89b2b5c Compare February 10, 2025 21:04
Fixes two issues which could cause race conditions when navigating between pages while custom protocol requests are in progress on macOS and iOS:
- The `obc2/catch-all` feature turns all Objective-C exceptions into panics, preventing `obc2::exception::catch(...)` from working.
- The `webview` and `task` objects passed to `start_task` were not retained, leading to use-after-free issues in the `responder`.
- `WryWebView::remove_custom_task_key` is called from both `stop_task` and `response` which may be in different threads, so `custom_protocol_task_ids` needs to be protected by a `Mutex`.

Closes tauri-apps#1189
@alexmoon alexmoon force-pushed the wkurlschemetask-crash branch from 89b2b5c to 210a651 Compare February 10, 2025 21:05
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.

[macOS] APP crash when a web custom protocol request is aborted before or during response
1 participant