wails/website/docs
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
..
appendix feat(website): sync documents and add content (#1215) 2022-03-06 16:18:02 +11:00
community add GameStacker to community showcase (#4724) 2025-11-22 14:44:00 +11:00
gettingstarted docs: Add Linux PATH Update Commands to Installation Guide (#4340) 2025-06-07 18:12:44 +10:00
guides feat(v2): add runtime.ResetSignalHandlers() for Linux panic recovery (#4921) 2026-02-02 18:55:57 +11:00
reference feat(v2): add runtime.ResetSignalHandlers() for Linux panic recovery (#4921) 2026-02-02 18:55:57 +11:00
tutorials [v2] Add -devtools production build flag (#2725) 2023-06-19 06:45:01 +10:00
howdoesitwork.mdx Update code block range in howdoesitwork.mdx (#4884) 2026-01-25 12:13:28 +11:00
introduction.mdx Remove link to expired varly.app domain 2024-03-24 17:27:24 +11:00