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

V2 bugfix/windows syscall go 1.23 #3707

Merged
merged 6 commits into from
Aug 28, 2024
Merged

Conversation

leaanthony
Copy link
Member

@leaanthony leaanthony commented Aug 25, 2024

Description

Updates dialog code to be compatible with Go 1.23.

Fixes #3681

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Created a new project with the same example as in the issue, used replace to point to the new code and tested manually.

  • Windows
  • macOS
  • Linux

Test Configuration

                                
          Wails Doctor          
                                


# Wails
Version  | v2.9.1                                  
Revision | be46683aa385e2d7c7c1e7cfcc184f7b0f18dd33
Modified | true                                    

# System
┌──────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Windows 10 Pro                                                                |
| Version      | 2009 (Build: 22631)                                                           |
| ID           | 23H2                                                                          |
| Go Version   | go1.22.4                                                                      |
| Platform     | windows                                                                       |
| Architecture | amd64                                                                         |
| CPU          | AMD Ryzen 9 3950X 16-Core Processor                                           |
| GPU          | Radeon RX 580 Series (Advanced Micro Devices, Inc.) - Driver: 26.20.13002.133 |
| Memory       | 64GB                                                                          |
└──────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version        |
| WebView2   | N/A          | Installed | 127.0.2651.105 |
| Nodejs     | N/A          | Installed | 20.14.0        |
| npm        | N/A          | Installed | 10.7.0         |
| *upx       | N/A          | Installed | upx 4.2.1      |
| *nsis      | N/A          | Installed | v3.09          |
└─────────────── * - Optional Dependency ────────────────┘

# Diagnosis
 SUCCESS  Your system is ready for Wails development!

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony

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

  • New Features

    • Introduced a new configuration setup supporting multiple programming environments, enhancing project organization.
    • Added deployment commands for easier application execution.
  • Bug Fixes

    • Resolved a nil check for Drag-and-Drop functionality on Windows to improve reliability.
    • Fixed a race condition in the notifyListeners() function, preventing unpredictable behavior.
    • Addressed dialog issues on Windows for better compatibility with Go version 1.23.
    • Fixed the absence of a cursor icon during drag-and-drop operations.
  • Documentation

    • Updated the changelog with recent enhancements and fixes to improve user awareness.

Copy link
Contributor

coderabbitai bot commented Aug 25, 2024

Walkthrough

The changes enhance the configuration of a multi-environment project, integrating support for Go, web technologies, and Node.js. Key updates include improved error handling in Go files, enhanced memory management, and modifications to system call invocations. Additionally, the changelog highlights fixes for issues affecting Windows compatibility, particularly with Go version 1.23, ensuring a more stable user experience.

Changes

Files Change Summary
.replit Updated module definitions and run commands; added Nix and deployment sections for improved configuration.
v2/internal/go-common-file-dialog/cfd/DialogConfig.go Enhanced error handling in apply method; added index validation for SelectedFileFilterIndex.
v2/internal/go-common-file-dialog/cfd/iShellItem.go Introduced memory management improvements; replaced syscall.Syscall with syscall.SyscallN.
v2/internal/go-common-file-dialog/cfd/iShellItemArray.go Updated getCount and getItemAt methods to use syscall.SyscallN for better argument handling.
v2/internal/go-common-file-dialog/cfd/vtblCommonFunc.go Transitioned to syscall.SyscallN in various methods; added error handling for nil pointers and empty strings.
website/src/pages/changelog.mdx Documented updates on Drag-n-Drop feature, race condition fixes, and compatibility improvements for Windows.

Assessment against linked issues

Objective Addressed Explanation
App crash on 1.23 sdk (cross compile from ubuntu to windows) if OpenDirectoryDialog (3681)

🐰 In the garden of code, we hop with glee,
Fixing bugs, making changes, just you wait and see!
With each little tweak, our app's shining bright,
A smoother experience, oh what a delight!
From Windows to Go, we dance in the sun,
With joy in our hearts, we’ve only just begun! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

cloudflare-workers-and-pages bot commented Aug 25, 2024

Deploying wails with  Cloudflare Pages  Cloudflare Pages

Latest commit: 68850fb
Status: ✅  Deploy successful!
Preview URL: https://7619f417.wails.pages.dev
Branch Preview URL: https://v2-bugfix-windows-syscall-go.wails.pages.dev

View logs

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: 10

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 87b1325 and f43a8be.

Files selected for processing (5)
  • .replit (1 hunks)
  • v2/internal/go-common-file-dialog/cfd/iShellItem.go (1 hunks)
  • v2/internal/go-common-file-dialog/cfd/iShellItemArray.go (2 hunks)
  • v2/internal/go-common-file-dialog/cfd/vtblCommonFunc.go (7 hunks)
  • website/src/pages/changelog.mdx (1 hunks)
Additional context used
LanguageTool
website/src/pages/changelog.mdx

[grammar] ~29-~29: The correct preposition appears to be “on”.
Context: ...ps://github.com/mrf345) - Fixed dialogs in Windows when using Go 1.23 in [PR](http...

(IN_WINDOWS)

Additional comments not posted (5)
v2/internal/go-common-file-dialog/cfd/vtblCommonFunc.go (4)

22-22: Transition to syscall.SyscallN in release method looks good.

The transition from syscall.Syscall to syscall.SyscallN is correctly implemented, enhancing flexibility and reducing potential errors.


29-31: Correct implementation of syscall.SyscallN in show method.

The method now correctly uses syscall.SyscallN, allowing for dynamic determination of argument count which simplifies the codebase.


80-82: Simplified setOptions method with syscall.SyscallN.

The use of syscall.SyscallN simplifies the method by removing the need to manually specify the number of arguments, reducing the chance of errors.


143-144: Simple transition in close method.

The method's transition to syscall.SyscallN is straightforward and reduces complexity.

website/src/pages/changelog.mdx (1)

29-29: Changelog entry for Go 1.23 dialog fix is clear and concise.

The entry correctly summarizes the fix for dialogs in Windows when using Go 1.23, providing clear information for users.

Tools
LanguageTool

[grammar] ~29-~29: The correct preposition appears to be “on”.
Context: ...ps://github.com/mrf345) - Fixed dialogs in Windows when using Go 1.23 in [PR](http...

(IN_WINDOWS)

Copy link

@leaanthony
Copy link
Member Author

@coderabbitai full review

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f43a8be and 68850fb.

Files selected for processing (3)
  • v2/internal/go-common-file-dialog/cfd/DialogConfig.go (2 hunks)
  • v2/internal/go-common-file-dialog/cfd/iShellItem.go (2 hunks)
  • v2/internal/go-common-file-dialog/cfd/vtblCommonFunc.go (7 hunks)
Files skipped from review as they are similar to previous changes (2)
  • v2/internal/go-common-file-dialog/cfd/iShellItem.go
  • v2/internal/go-common-file-dialog/cfd/vtblCommonFunc.go
Additional comments not posted (3)
v2/internal/go-common-file-dialog/cfd/DialogConfig.go (3)

5-5: LGTM!

The import of the fmt package is appropriate for the new error handling logic.

The code changes are approved.


6-6: LGTM!

The blank line improves readability.

The code changes are approved.


107-110: LGTM!

The new conditional check ensures that the SelectedFileFilterIndex does not exceed the bounds of the fileFilters slice, enhancing the robustness of the function.

The code changes are approved.

Copy link
Contributor

coderabbitai bot commented Aug 27, 2024

@leaanthony: I have re-reviewed the entire PR, and the changes look good. The transition from syscall.Syscall to syscall.SyscallN has been implemented correctly across the relevant files, enhancing the robustness and flexibility of the system calls. The changelog has also been updated to reflect the fix for the compatibility issue with Go 1.23.

All previous conversations have been addressed, and there are no outstanding issues. The PR is ready for approval.

Analysis chain
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Re-review the changes in the PR by analyzing the modified files.

# Re-review the changes in the iShellItem.go file.
ast-grep --lang go --pattern 'func (vtbl *iShellItemVtbl) getDisplayName($_) ($_, $_)' -A 10

# Re-review the changes in the iShellItemArray.go file.
ast-grep --lang go --pattern 'func (vtbl *iShellItemArrayVtbl) getCount($_) ($_, $_)' -A 10
ast-grep --lang go --pattern 'func (vtbl *iShellItemArrayVtbl) getItemAt($_) ($_, $_)' -A 10

# Re-review the changes in the vtblCommonFunc.go file.
ast-grep --lang go --pattern 'func (vtbl *$_) $_($_) ($_, $_)' -A 10

# Re-review the changes in the changelog.mdx file.
rg 'Go 1.23' -A 5

Length of output: 13772

Actions performed

Comments resolved.

Copy link
Contributor

coderabbitai bot commented Aug 27, 2024

Actions performed

Full review triggered.

Copy link
Contributor

coderabbitai bot commented Aug 27, 2024

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

Commits

Files that changed from the base of the PR and between 87b1325 and 68850fb.

Files selected for processing (6)
  • .replit (1 hunks)
  • v2/internal/go-common-file-dialog/cfd/DialogConfig.go (2 hunks)
  • v2/internal/go-common-file-dialog/cfd/iShellItem.go (2 hunks)
  • v2/internal/go-common-file-dialog/cfd/iShellItemArray.go (2 hunks)
  • v2/internal/go-common-file-dialog/cfd/vtblCommonFunc.go (7 hunks)
  • website/src/pages/changelog.mdx (1 hunks)
________________________
< Tree-sitter is my GPS. >
------------------------
 \
  \   (\__/)
      (•ㅅ•)
      /   づ

Tip

You can generate walkthrough in a markdown collapsible section to save space.

Enable the reviews.collapse_walkthrough setting in your project's settings in CodeRabbit to generate walkthrough in a markdown collapsible section.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

Outside diff range, codebase verification and nitpick comments (2)
.replit (1)

1-1: Update the Go version in the configuration and test for compatibility.

The .replit file currently specifies "go-1.21" and does not include "go-1.23". Update the configuration to reflect Go 1.23 and ensure that the codebase is tested for compatibility with this version.

  • Update the .replit file to include "go-1.23".
  • Test the codebase to ensure compatibility with Go 1.23.
Analysis chain

Ensure compatibility with the latest Go version.

The modules list includes "go-1.21". Ensure that this configuration is compatible with Go 1.23, as mentioned in the PR objectives.

Verify the compatibility with the latest Go version:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility with Go 1.23.

# Test: Check if the module "go-1.21" is compatible with Go 1.23.
grep -q "go-1.23" .replit && echo "Compatible" || echo "Not Compatible"

Length of output: 64

website/src/pages/changelog.mdx (1)

29-29: Correct the preposition.

The correct preposition appears to be "on" instead of "in".

- Fixed dialogs in Windows when using Go 1.23 in [PR](https://github.com/wailsapp/wails/pull/3707) by [@leaanthony](https://github.com/leaanthony)
+ Fixed dialogs on Windows when using Go 1.23 in [PR](https://github.com/wailsapp/wails/pull/3707) by [@leaanthony](https://github.com/leaanthony)
Tools
LanguageTool

[grammar] ~29-~29: The correct preposition appears to be “on”.
Context: ...ps://github.com/mrf345) - Fixed dialogs in Windows when using Go 1.23 in [PR](http...

(IN_WINDOWS)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 87b1325 and 68850fb.

Files selected for processing (6)
  • .replit (1 hunks)
  • v2/internal/go-common-file-dialog/cfd/DialogConfig.go (2 hunks)
  • v2/internal/go-common-file-dialog/cfd/iShellItem.go (2 hunks)
  • v2/internal/go-common-file-dialog/cfd/iShellItemArray.go (2 hunks)
  • v2/internal/go-common-file-dialog/cfd/vtblCommonFunc.go (7 hunks)
  • website/src/pages/changelog.mdx (1 hunks)
Additional context used
LanguageTool
website/src/pages/changelog.mdx

[grammar] ~29-~29: The correct preposition appears to be “on”.
Context: ...ps://github.com/mrf345) - Fixed dialogs in Windows when using Go 1.23 in [PR](http...

(IN_WINDOWS)

Additional comments not posted (22)
.replit (3)

2-2: LGTM!

The run command is correctly set to execute the main Go file.

The code changes are approved.


4-5: LGTM!

The Nix channel is correctly set to "stable-24_05".

The code changes are approved.


7-8: LGTM!

The deployment run command is correctly set to execute the main Go file.

The code changes are approved.

v2/internal/go-common-file-dialog/cfd/iShellItem.go (2)

33-35: Good practice: Improved memory management.

The deferred function ensures that pathPtr is properly freed, preventing potential memory leaks.

The code changes are approved.


47-49: Enhance robustness: Transition to syscall.SyscallN.

The transition from syscall.Syscall to syscall.SyscallN improves the robustness of the function by explicitly indicating the number of arguments being passed.

The code changes are approved.

v2/internal/go-common-file-dialog/cfd/iShellItemArray.go (2)

41-43: Enhance robustness: Transition to syscall.SyscallN.

The transition from syscall.Syscall to syscall.SyscallN improves the robustness of the function by explicitly indicating the number of arguments being passed.

The code changes are approved.


52-55: Enhance robustness: Transition to syscall.SyscallN.

The transition from syscall.Syscall to syscall.SyscallN improves the robustness of the function by explicitly indicating the number of arguments being passed.

The code changes are approved.

v2/internal/go-common-file-dialog/cfd/DialogConfig.go (2)

5-6: LGTM!

The import of the fmt package is appropriate for generating formatted error messages.

The code changes are approved.


107-110: Improved error handling for SelectedFileFilterIndex.

The additional check ensures that the SelectedFileFilterIndex is within the valid range of the fileFilters slice, preventing potential runtime errors.

The code changes are approved.

v2/internal/go-common-file-dialog/cfd/vtblCommonFunc.go (13)

21-23: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency.

The code changes are approved.


28-30: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency.

The code changes are approved.


47-56: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency. The deferred freeing of allocated strings ensures proper memory management.

The code changes are approved.


88-90: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency.

The code changes are approved.


96-98: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency.

The code changes are approved.


124-126: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency.

The code changes are approved.


136-138: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency.

The code changes are approved.


144-147: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency. The deferred freeing of allocated strings ensures proper memory management.

The code changes are approved.


152-153: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency.

The code changes are approved.


159-161: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency.

The code changes are approved.


178-186: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency. The additional check for a nil GUID improves robustness.

The code changes are approved.


193-205: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency. The additional check for an empty string and the deferred freeing of allocated strings improve robustness and memory management.

The code changes are approved.


213-216: LGTM!

The transition to syscall.SyscallN enhances flexibility and efficiency. The deferred freeing of allocated strings ensures proper memory management.

The code changes are approved.

@leaanthony leaanthony merged commit 475534c into master Aug 28, 2024
14 checks passed
@leaanthony leaanthony deleted the v2-bugfix/windows-syscall-go-1.23 branch August 28, 2024 09:25
therealsamf pushed a commit to therealsamf/wails that referenced this pull request Aug 29, 2024
* Initial test

* Fix calls

* Update changelog.mdx

* Free allocated strings

* Misc fixes
@Eviden0
Copy link

Eviden0 commented Sep 28, 2024

The 1.23version bug makes me very sad!
Thank you to fix it!

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.

App crash on 1.23 sdk (cross compile from ubuntu to windows) if OpenDirectoryDialog
2 participants