Skip to content

Fix single instance for v3 in sandboxed mode on MacOS - #5289

Merged
leaanthony merged 5 commits into
wailsapp:masterfrom
overlordtm:fix/v3-sandbox-single-instance
May 11, 2026
Merged

leaanthony merged 5 commits into
wailsapp:masterfrom
overlordtm:fix/v3-sandbox-single-instance

Conversation

@overlordtm

@overlordtm overlordtm commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes crash when using single instance for sandboxed app on MacOS in v3.0.0-alpha.80. Tested on MacOS Sonoma 14.8.5. Conceptualy quite similar to v2 fix from #3029

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?

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

If you checked Linux, please specify the distro and version.

Test Configuration

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

 Wails (v3.0.0-alpha.80)  Wails Doctor 
                                                                                                                                                                                                                                      
# System 

┌────────────────────────────────────────────────┐
| Name          | MacOS                          |
| Version       | 14.8.5                         |
| ID            | 23J423                         |
| Branding      | Sonoma                         |
| Platform      | darwin                         |
| Architecture  | amd64                          |
| Apple Silicon | unknown                        |
| CPU           | Intel Core Processor (Haswell) |
| CPU           | Intel Core Processor (Haswell) |
| GPU           |  cores                         |
| Memory        | 16 GB                          |
└────────────────────────────────────────────────┘

# Build Environment 

┌────────────────────────────────┐
| Wails CLI    | v3.0.0-alpha.80 |
| Go Version   | go1.25.9        |
| -buildmode   | exe             |
| -compiler    | gc              |
| CGO_CFLAGS   |                 |
| CGO_CPPFLAGS |                 |
| CGO_CXXFLAGS |                 |
| CGO_ENABLED  | 1               |
| CGO_LDFLAGS  |                 |
| GOAMD64      | v1              |
| GOARCH       | amd64           |
| GOOS         | darwin          |
└────────────────────────────────┘

# Dependencies 

┌────────────────────────────────────────────────────────────────────────┐
| *NSIS           | Not Installed. Install with `brew install makensis`. |
| Xcode cli tools | 2408                                                 |
| npm             | 11.8.0                                               |
| docker          | *Not installed (optional - for cross-compilation)    |
|                                                                        |
└─────────────────────── * - Optional Dependency ────────────────────────┘

# Checking for issues 

 SUCCESS  No issues found

# Diagnosis 

 SUCCESS  Your system is ready for Wails development!

Need documentation? Run: wails3 docs
 ♥   If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor

Checklist:

  • (v2 only) I have updated website/src/pages/changelog.mdx with details of this PR (v3 changelog entries are added automatically)
  • 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 single-instance mode reliability on macOS for better compatibility with sandboxed environments and more robust inter-instance communication.

@coderabbitai

coderabbitai Bot commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e3cb133d-e7dc-4121-aba2-2e5c738c7f03

📥 Commits

Reviewing files that changed from the base of the PR and between 0ea803b and 655263e.

📒 Files selected for processing (2)
  • v3/pkg/application/application_darwin_delegate.m
  • v3/pkg/application/single_instance_darwin.go

Walkthrough

Coordinated changes to macOS single-instance notification handling: the distributed notification now carries the message via the notification object (as UTF-8 NSString) instead of the userInfo dictionary. Additionally, temporary directory selection shifts from os.TempDir() to NSTemporaryDirectory() for sandbox compliance.

Changes

Cohort / File(s) Summary
macOS Single-Instance Notification Refactoring
v3/pkg/application/application_darwin_delegate.m, v3/pkg/application/single_instance_darwin.go
Modified distributed notification mechanism: message now passed via notification object instead of userInfo dictionary. Updated temp directory selection to use Objective-C helper (NSTemporaryDirectory()) for sandbox-appropriate paths with proper C string memory cleanup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

MacOS

Suggested reviewers

  • leaanthony
  • makew0rld

Poem

🐰 A message hops through notifications bright,
No userInfo needed—the object's right!
Sandbox directories now find their way,
Darwin's paths cleaned up, hooray, hooray! 🍎

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing single instance functionality for sandboxed macOS applications in v3, which matches the primary objective of the PR.
Description check ✅ Passed The description is mostly complete with the issue being fixed stated, change type selected, and testing details provided for macOS with wails doctor output; however, the PR does not reference a specific issue number in the format 'Fixes #'.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.4)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@leaanthony

Copy link
Copy Markdown
Member

✅ Triaged by Wails PR Reviewer

This PR has been reviewed and accepted. A test sub-issue has been created for macOS.

Head Ref OID: 655263ea48e42f5947c7524b057e70496406f691


This comment serves as a signature that this PR has been triaged. Future runs will skip this PR based on the headRefOid.

@leaanthony
leaanthony enabled auto-merge (squash) May 3, 2026 03:31
@leaanthony
leaanthony merged commit 2f23428 into wailsapp:master May 11, 2026
14 checks passed
leaanthony pushed a commit to vinhvoit225/wails that referenced this pull request May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants