Skip to content

fix(macos): handle nil NSOpenPanel in run_file_upload_panel#1716

Open
MrSaturn1 wants to merge 1 commit into
tauri-apps:devfrom
Zyphra:fix-nsopenpanel-nil
Open

fix(macos): handle nil NSOpenPanel in run_file_upload_panel#1716
MrSaturn1 wants to merge 1 commit into
tauri-apps:devfrom
Zyphra:fix-nsopenpanel-nil

Conversation

@MrSaturn1

Copy link
Copy Markdown

NSOpenPanel::openPanel() can return nil in rare macOS edge cases (code-signature mismatch after in-place app update, system wake transient). The typed objc2 binding panics on nil, crashing the app.

Use raw msg_send + Retained::retain to detect nil and gracefully cancel the file picker by calling the WebKit completion handler with null.

Fixes tauri-apps/tauri#13047

@MrSaturn1 MrSaturn1 requested a review from a team as a code owner April 23, 2026 19:34
@github-actions

github-actions Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Package Changes Through 0fb3d76

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.55.0 0.56.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

pewsheen
pewsheen previously approved these changes Apr 24, 2026

@pewsheen pewsheen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NSOpenPanel::openPanel() can return nil in rare edge cases on macOS
(code-signature mismatch after in-place update, system wake transient).
The typed objc2 binding panics on nil, crashing the app.

Use raw msg_send + Retained::retain to detect nil and gracefully cancel
the file picker by calling the WebKit completion handler with null.

Fixes tauri-apps/tauri#13047
@pewsheen

Copy link
Copy Markdown
Contributor

Hmm,lLooks like you'll need to upload your public signing key to GitHub, otherwise the commit will remain unverified.

@dwosk

dwosk commented Apr 28, 2026

Copy link
Copy Markdown

Thanks @MrSaturn1!!

@Legend-Master Legend-Master added the status: waiting Waiting for a response or another PR label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: macOS status: waiting Waiting for a response or another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] [macOS] NSOpenPanel openPanel returns NULL

4 participants