From c3a98b058e37e2d32f10438e33b181c93cee786a Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 7 Apr 2022 22:42:17 +0200 Subject: [PATCH] ensure webkit/gtk callbacks run on main thread (#1320) prevent close event being propagated when handled in app closes #1268 closes #1288 --- v2/internal/frontend/desktop/linux/frontend.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/v2/internal/frontend/desktop/linux/frontend.go b/v2/internal/frontend/desktop/linux/frontend.go index 3834376fa..bcf445807 100644 --- a/v2/internal/frontend/desktop/linux/frontend.go +++ b/v2/internal/frontend/desktop/linux/frontend.go @@ -17,6 +17,7 @@ import ( "log" "net/http" "os" + "runtime" "strconv" "text/template" "unsafe" @@ -49,6 +50,10 @@ type Frontend struct { servingFromDisk bool } +func init() { + runtime.LockOSThread() +} + func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.Logger, appBindings *binding.Bindings, dispatcher frontend.Dispatcher) *Frontend { // Set GDK_BACKEND=x11 to prevent warnings