fix(linux): dispatch dialog GTK calls via InvokeAsync to fix GTK3 segfault#5339
Conversation
…fault Commit 5dc3e21 (GTK4 support, #4958) replaced InvokeAsync with a bare go func() in linuxDialog.show(). GTK3 requires all GTK calls to run on the main thread; launching them from a goroutine causes a segfault. Use InvokeAsync (same pattern as showAboutDialog) so runQuestionDialog is dispatched to the GTK main thread on both GTK3 and GTK4. The button callback is still invoked in a goroutine since it is not a GTK call. Fixes #5338 Co-authored-by: multica-agent <github@multica.ai>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe change replaces a raw goroutine launch with ChangesLinux Dialog Thread Safety
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.12.1)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. Comment |
…ispatch dialog GTK calls via InvokeAsync to fix GTK3 segfault
Closes #5338
Root cause
linuxDialog.show()launchedrunQuestionDialog()— which callsgtk_dialog_run()— from a bare goroutine. GTK3 is not thread-safe; all GTK/GDK calls must run on the GLib main thread. Running them from an arbitrary OS thread is undefined behaviour and causes segfaults.Commit 5dc3e21 (GTK4 support, PR #4958) replaced the correct
InvokeAsynccall with a barego func(), breaking GTK3 users.Fix
Replace
go func() { ... }()withInvokeAsync(func() { ... })inlinuxDialog.show(). This matches the pattern already used byshowAboutDialogin the same file, which was unchanged and works correctly.The inner
go func()for user button callbacks is preserved — those are not GTK calls and are correct to run on a goroutine.Testing
go test ./v3/pkg/application/— all 170+ tests passdialogs-basicexample) builds cleanly withCGO_ENABLED=1Summary by CodeRabbit