wails/website/docs/guides
Lea Anthony 01b661f6a5
feat(v2): add runtime.ResetSignalHandlers() for Linux panic recovery (#4921)
* feat(v2): add runtime.ResetSignalHandlers() for Linux panic recovery

Add a new runtime function that allows users to reset signal handlers
before code that might panic from nil pointer dereferences.

On Linux, WebKit installs signal handlers without the SA_ONSTACK flag,
which prevents Go from properly recovering from panics caused by
SIGSEGV and other signals. This function adds SA_ONSTACK to the
relevant signal handlers (SIGSEGV, SIGBUS, SIGFPE, SIGABRT).

Usage:
```go
go func() {
    defer func() {
        if err := recover(); err != nil {
            log.Printf("Recovered: %v", err)
        }
    }()
    runtime.ResetSignalHandlers()
    // Code that might panic...
}()
```

The function is a no-op on macOS and Windows.

Fixes #3965

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(v2): add panic-recovery-test example

Add an example that demonstrates the Linux signal handler issue (#3965)
and verifies the fix using runtime.ResetSignalHandlers().

The example includes:
- A Greet function that triggers a nil pointer dereference after a delay
- Auto-call from frontend after 5 seconds
- README with reproduction steps

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 18:55:57 +11:00
..
_category_.json [v2] Docs update 2021-09-27 19:35:30 +10:00
angular.mdx Add Angular docs 2022-10-29 19:35:41 +11:00
application-development.mdx [v2] docs(app-dev): fix inconsistent indentation (#4730) 2025-11-30 17:40:51 +11:00
crossplatform-build.mdx Fixed typo (#3846) 2024-11-07 22:24:32 +11:00
custom-protocol-schemes.mdx V2 - Add universal link support for macOS (#4693) 2025-12-10 16:14:23 +11:00
dynamic-assets.mdx add warning about dynamic assets and vite v5.0.0+ (#3254) 2024-02-22 08:03:45 +01:00
file-association.mdx Implement Single instance lock feature with passing arguments to initial instance (#2951) 2023-10-23 21:31:56 +11:00
frameless.mdx [assetserver] Introduce middleware and extract options (#2016) 2022-10-29 23:15:15 +02:00
frontend.mdx Fix typos (#3628) 2024-08-20 19:22:43 +10:00
ides.mdx docs: add guides ide change goland option and reference cli add options vscode or goland (#3419) 2024-04-23 08:07:22 +10:00
linux-distro-support.mdx feat: optimize documentation website (#1849) 2022-09-18 22:01:50 +10:00
linux.mdx feat(v2): add runtime.ResetSignalHandlers() for Linux panic recovery (#4921) 2026-02-02 18:55:57 +11:00
local-development.mdx Rename bleeding edge -> local development (#2086) 2022-11-13 22:44:50 +11:00
mac-appstore.mdx Update Mac AppStore Guide to support app names containing spaces (#3923) 2024-11-30 09:09:37 +11:00
manual-builds.mdx feat(website): repair document content (#1775) 2022-08-22 19:59:28 +10:00
migrating.mdx chore: fix some comments (#3399) 2024-04-17 18:42:53 +10:00
mouse-buttons.mdx feat(website): repair document content (#1775) 2022-08-22 19:59:28 +10:00
nixos-font.mdx Fix typos (#3628) 2024-08-20 19:22:43 +10:00
obfuscated.mdx Fix link to project config 2024-05-05 17:36:08 +10:00
overscroll.mdx feat: optimize documentation website (#1849) 2022-09-18 22:01:50 +10:00
routing.mdx docs: add guide for routing in Svelte (#3481) 2024-06-08 21:17:12 +10:00
signing.mdx Modified docs to reflect the correct password syntax for the gon-sign.json file (#3620) 2024-08-25 11:33:09 +00:00
single-instance-lock.mdx Implement Single instance lock feature with passing arguments to initial instance (#2951) 2023-10-23 21:31:56 +11:00
sveltekit.mdx chore: update svelte CLI command (#3912) 2024-11-25 19:13:55 +11:00
templates.mdx feat: optimize documentation website (#1849) 2022-09-18 22:01:50 +10:00
troubleshooting.mdx Add mac compile error troubleshooting tip 2023-10-21 20:24:56 +11:00
vscode.mdx fix frontend/tsconfig.js (#1795) 2022-08-27 06:55:49 +10:00
windows-installer.mdx Fix scoop command usage typo (#3501) 2024-05-23 06:03:23 +10:00
windows.mdx Documentation: Specify how to handle the Fixed WebView Runtime. (#3444) 2024-06-20 05:40:36 +10:00