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

[v3] fix: unhandled error in dialogs.go #4156

Open
wants to merge 3 commits into
base: v3-alpha
Choose a base branch
from

Conversation

johannes-luebke
Copy link

@johannes-luebke johannes-luebke commented Mar 20, 2025

Description

The returned error from InvokeSyncWithResultAndError wasn't handled before and the selections channel could be nil. This leads to a deadlock, at least on Windows, if there is an error. For example if the user cancels the dialog it will deadlock.

I haven't found an issue for this problem. I hope it's fine I jumped straight to PR, otherwise I'm happy to write this down as an issue first.

Type of change

Please select the option that is relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

I've tested this in my project which has a very particular setup using htmx and it actually results in a full deadlock.
But I've also reproduced the issue with the v3/examples/dialogs-basic/main.go. Here it does lock the goroutine, but because of the way the menu calls work it's hard to notice. Placing a debug print just before the return shows that it is never reached in case the user cancels the dialog.

  • Windows
  • macOS
  • Linux

Test Configuration

Wails Doctor

System

┌─────────────────────────────────────────────────────────────────────────────────┐
| Name | Windows 10 Pro |
| Version | 2009 (Build: 26100) |
| ID | 24H2 |
| Branding | Windows 11 Pro |
| Platform | windows |
| Architecture | amd64 |
| Go WebView2Loader | true |
| WebView2 Version | 134.0.3124.72 |
| CPU | AMD Ryzen Threadripper PRO 5965WX 24-Cores |
| GPU 1 | ASPEED Graphics Family(WDDM) (ASPEED) - Driver: 9.0.10.110 |
| GPU 2 | NVIDIA GeForce RTX 4090 (NVIDIA) - Driver: 32.0.15.6636 |
| Memory | 128GB |
└─────────────────────────────────────────────────────────────────────────────────┘

Build Environment

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Wails CLI | v3.0.0-alpha.9 |
| Go Version | go1.23.5 |
| -buildmode | exe |
| -compiler | gc |
| CGO_CFLAGS | |
| CGO_CPPFLAGS | |
| CGO_CXXFLAGS | |
| CGO_ENABLED | 1 |
| CGO_LDFLAGS | |
| DefaultGODEBUG | asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1 |
| GOAMD64 | v1 |
| GOARCH | amd64 |
| GOOS | windows |
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Dependencies

┌───────────────────────────┐
| npm | 10.7.0 |
| NSIS | Not Installed |
└─ * - Optional Dependency ─┘

Diagnosis

SUCCESS Your system is ready for Wails development!

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling in multi-selection dialogs to ensure any issues during the selection process are clearly communicated.
    • Added a changelog entry for version 2.9.1 addressing a locking issue on Windows when a multiselect dialog returns an error.

Does lead to deadlocks otherwise
Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

Walkthrough

A change was made in the v3/pkg/application/dialogs.go file within the PromptForMultipleSelection method. The update adds error handling immediately after calling InvokeSyncWithResultAndError(d.impl.show). If an error is detected during the dialog display, the method now returns nil for the selections along with the error, ensuring that the failure is communicated to the caller.

Changes

File Change Summary
v3/pkg/application/dialogs.go Enhanced the PromptForMultipleSelection method by adding error checking after invoking the dialog's show function.
website/src/pages/changelog.mdx Added a changelog entry for version 2.9.1 addressing a locking issue on Windows related to multiselect dialog errors.

Possibly related issues

Possibly related PRs

  • V2 bugfix/windows syscall go 1.23 #3707: The changes in the main PR, which enhance error handling in the PromptForMultipleSelection method, are related to the improvements made in the DialogConfig.go file of the retrieved PR, where error handling is also enhanced in the apply method.
  • recover from process message instead crash the whole app #4016: The changes in the main PR focus on enhancing error handling in the PromptForMultipleSelection method, while the retrieved PR modifies error handling in the ProcessMessage method; thus, they are related through their shared goal of improving error management in different methods.

Suggested reviewers

  • leaanthony

Poem

I'm a bunny with joyful hops,
Skipping through code that never stops.
Error checks now bloom bright as day,
Guiding our dialogs on the proper way.
With every change, our code finds its way!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
website/src/pages/changelog.mdx (1)

21-21: Avoid Repeating "Fixed" for Improved Readability

The bullet point in line 21 starts its sentences with "Fixed," which can feel repetitive when read in succession. Consider rewording it to enhance clarity and style. For example:

- Fixed locking issue on Windows when multiselect dialog returns an error. Fixed in [PR](https://github.com/wailsapp/wails/pull/4156) by @johannes-luebke
+ Resolved a locking issue on Windows occurring when a multiselect dialog returns an error. See [PR](https://github.com/wailsapp/wails/pull/4156) by @johannes-luebke.
🧰 Tools
🪛 LanguageTool

[style] ~21-~21: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...sapp/wails/pull/3545) by @leaanthony. - Fixed locking issue on Windows when multisele...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~21-~21: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...en multiselect dialog returns an error. Fixed in [PR](https://github.com/wailsapp/wai...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14d6623 and 0101004.

📒 Files selected for processing (1)
  • website/src/pages/changelog.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
website/src/pages/changelog.mdx

[style] ~21-~21: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...sapp/wails/pull/3545) by @leaanthony. - Fixed locking issue on Windows when multisele...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~21-~21: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...en multiselect dialog returns an error. Fixed in [PR](https://github.com/wailsapp/wai...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
website/src/pages/changelog.mdx (1)

17-19: Changelog Entry Addition & Consistency Check
The newly added entry clearly documents the fix for the Windows locking issue when the multiselect dialog returns an error (referencing PR #4156 by @johannes-luebke). Please double-check that the wording complies with our changelog style (based on Keep a Changelog and Semantic Versioning) and that it is free of accidental word duplications as hinted by static analysis.

🧰 Tools
🪛 LanguageTool

[duplication] ~17-~17: Possible typo: you repeated a word.
Context: ... vulnerabilities. ## [Unreleased] ### Fixed - Fixed locking issue on Windows when multisele...

(ENGLISH_WORD_REPEAT_RULE)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0101004 and 4714025.

📒 Files selected for processing (1)
  • website/src/pages/changelog.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
website/src/pages/changelog.mdx

[duplication] ~17-~17: Possible typo: you repeated a word.
Context: ... vulnerabilities. ## [Unreleased] ### Fixed - Fixed locking issue on Windows when multisele...

(ENGLISH_WORD_REPEAT_RULE)

@johannes-luebke johannes-luebke changed the title fix: unhandled error in dialogs.go [v3] fix: unhandled error in dialogs.go Mar 21, 2025
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.

1 participant