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 systemTray.setIcon crashing on Linux #3636

Closed

Conversation

windom
Copy link

@windom windom commented Jul 25, 2024

Description

Changing the system tray icon, after the application has started results in the panic listed below.
To reproduce add the following code just before calling app.Run() in v3/examples/systray/main.go:

app.On(events.Common.ApplicationStarted, func(event *application.Event) {
	systemTray.SetIcon(icons.SystrayDark)
})
panic: dbus.Store: type mismatch: cannot convert application.PX to []application.PX

goroutine 1 [running, locked to thread]:
github.com/godbus/dbus/v5/prop.(*Properties).SetMust(0xc000230200, {0xa447a1, 0x1a}, {0xa37fd7, 0xa}, {0x9d1d80, 0xc0001fc7e0})
	/home/windom/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/prop/prop.go:346 +0xec
github.com/wailsapp/wails/v3/pkg/application.(*linuxSystemTray).setIcon(0xc00021c080, {0xee5500?, 0xc00003d5d0?, 0x42197f?})
	/home/windom/uprock/wails/v3/pkg/application/systemtray_linux.go:378 +0x169
github.com/wailsapp/wails/v3/pkg/application.(*SystemTray).SetIcon.func1()
	/home/windom/uprock/wails/v3/pkg/application/systemtray.go:136 +0x32
github.com/wailsapp/wails/v3/pkg/application.InvokeSync.func1()
	/home/windom/uprock/wails/v3/pkg/application/mainthread.go:28 +0x42
github.com/wailsapp/wails/v3/pkg/application.executeOnMainThread(0x2)
	/home/windom/uprock/wails/v3/pkg/application/mainthread_linux.go:17 +0xef
github.com/wailsapp/wails/v3/pkg/application.dispatchOnMainThreadCallback(...)
	/home/windom/uprock/wails/v3/pkg/application/linux_cgo.go:295
github.com/wailsapp/wails/v3/pkg/application._Cfunc_g_application_run(0x2f94670, 0x0, 0x0)
	_cgo_gotypes.go:1226 +0x4b
github.com/wailsapp/wails/v3/pkg/application.appRun.func4(0x2f94670)
	/home/windom/uprock/wails/v3/pkg/application/linux_cgo.go:373 +0x45
github.com/wailsapp/wails/v3/pkg/application.appRun(0x2f94670)
	/home/windom/uprock/wails/v3/pkg/application/linux_cgo.go:373 +0x7d
github.com/wailsapp/wails/v3/pkg/application.(*linuxApp).run(0xc00016ea00)
	/home/windom/uprock/wails/v3/pkg/application/application_linux.go:100 +0x52
github.com/wailsapp/wails/v3/pkg/application.(*App).Run(0xc0001e6308)
	/home/windom/uprock/wails/v3/pkg/application/application.go:553 +0x408
main.main()
	/home/windom/uprock/wails/v3/examples/systray/main.go:102 +0x8df
exit status 2

Fixes # (issue)

Type of change

Please delete options that are not 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?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux

Test Configuration

# System
┌───────────────────────────────────────────────────────────────────────────────────────────┐
| Name         | Ubuntu                                                                     |
| Version      | 24.04                                                                      |
| ID           | ubuntu                                                                     |
| Branding     | 24.04 LTS (Noble Numbat)                                                   |
| Platform     | linux                                                                      |
| Architecture | amd64                                                                      |
| CPU          | Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz                                   |
| GPU 1        | TU116M [GeForce GTX 1660 Ti Mobile] (NVIDIA Corporation) - Driver: nvidia  |
| GPU 2        | CoffeeLake-H GT2 [UHD Graphics 630] (Intel Corporation) - Driver: i915     |
| Memory       | 16GB                                                                       |
└───────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment
┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-alpha.4                           |
| Go Version   | go1.22.4                                 |
| Revision     | f0cec1cf376978f047d23a75b1da727111d358f6 |
| Modified     | false                                    |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_ENABLED  | 0                                        |
| GOAMD64      | v1                                       |
| GOARCH       | amd64                                    |
| GOOS         | linux                                    |
| vcs          | git                                      |
| vcs.modified | false                                    |
| vcs.revision | f0cec1cf376978f047d23a75b1da727111d358f6 |
| vcs.time     | 2024-07-16T20:44:46Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────┐
| webkit2gtk | 2.44.2-0ubuntu0.24.04.2 |
| gcc        | 12.10ubuntu1            |
| gtk3       | 3.24.41-4ubuntu1.1      |
| npm        | 10.8.2                  |
| pkg-config | 1.8.1-2build1           |
└────── * - Optional Dependency ───────┘

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

Copy link
Contributor

coderabbitai bot commented Jul 25, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

@tmclane
Copy link
Member

tmclane commented Jul 25, 2024

Thank you for raising the issue and providing the fix!

@tmclane
Copy link
Member

tmclane commented Jul 25, 2024

Would you please update the changelog and then I'll merge it.

mkdocs-website/docs/en/changelog.md

@windom windom force-pushed the v3/fix-linux-systray-seticon branch from 3d9504b to 08ac7e8 Compare July 25, 2024 17:07
Copy link

sonarcloud bot commented Jul 25, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@windom
Copy link
Author

windom commented Jul 25, 2024

Updated changelog and force-pused.

Copy link
Member

@tmclane tmclane left a comment

Choose a reason for hiding this comment

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

Thank you!

@tmclane
Copy link
Member

tmclane commented Jul 25, 2024

This has been merged.

@tmclane tmclane closed this Jul 25, 2024
@windom windom deleted the v3/fix-linux-systray-seticon branch August 15, 2024 16:48
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