mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
fix(v2/linux): fix crash on panic in JS-bound Go methods (#4855)
* fix(v2/linux): fix crash on panic in JS-bound Go methods WebKit2GTK installs signal handlers after gtk_main() starts, overriding our SA_ONSTACK fix. This causes Go panics (e.g., nil pointer dereference) in JS-bound methods to crash with 'non-Go code set up signal handler without SA_ONSTACK flag'. Fix by deferring signal handler installation via g_idle_add() to run after GTK main loop starts, ensuring we fix handlers AFTER WebKit has installed its own. Fixes #3965 * docs: add changelog entry for Linux signal handler fix Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
696c55c6ee
commit
7ee2b2d856
2 changed files with 12 additions and 1 deletions
|
|
@ -73,6 +73,16 @@ static void install_signal_handlers()
|
|||
#endif
|
||||
}
|
||||
|
||||
static gboolean install_signal_handlers_idle(gpointer data) {
|
||||
(void)data;
|
||||
install_signal_handlers();
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void fix_signal_handlers_after_gtk_init() {
|
||||
g_idle_add(install_signal_handlers_idle, NULL);
|
||||
}
|
||||
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
|
|
@ -204,7 +214,7 @@ func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.
|
|||
|
||||
result.mainWindow = NewWindow(appoptions, result.debug, result.devtoolsEnabled)
|
||||
|
||||
C.install_signal_handlers()
|
||||
C.fix_signal_handlers_after_gtk_init()
|
||||
|
||||
if appoptions.Linux != nil && appoptions.Linux.ProgramName != "" {
|
||||
prgname := C.CString(appoptions.Linux.ProgramName)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
|
||||
- Fixed Linux crash on panic in JS-bound Go methods due to WebKit overriding signal handlers [#3965](https://github.com/wailsapp/wails/issues/3965) by @leaanthony
|
||||
- Fixed code block range in "How Does It Work?" documentation [#4884](https://github.com/wailsapp/wails/pull/4884) by @msal4
|
||||
- Fixed WebView crash on macOS 26 (Tahoe) during rapid UI updates [#4592](https://github.com/wailsapp/wails/issues/4592) by @leaanthony
|
||||
- Updated menu reference docs with complete imports by @agilgur5 in [#4727](https://github.com/wailsapp/wails/pull/4727) and [#4742](https://github.com/wailsapp/wails/pull/4742)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue