Store the UI thread ID earlier

This commit is contained in:
Stefan Haller committed 2026-07-17 12:35:54 +02:00
1 parent 87ef96974e
commit c23bcd6d94
1 file changed
+6 -2
+6 -2
View File
@@ -293,6 +293,12 @@ func NewGui(opts NewGuiOpts) (*Gui, error) {
g.playRecording = opts.PlayRecording
// Record the UI thread here, at construction. This assumes NewGui is called
// on the same goroutine that will run MainLoop, which holds for all our
// callers -- and it means IsUIThread is already correct for the UI work that
// runs during startup, before we reach MainLoop.
g.uiThreadID.Store(goid.Get())
return g, nil
}
@@ -977,8 +983,6 @@ func (g *Gui) SetManagerFunc(manager func(*Gui) error) {
func (g *Gui) MainLoop() error {
defer close(g.loopExited)
g.uiThreadID.Store(goid.Get())
go func() {
for {
select {