Fix Fyne threading error by using async Do() instead of DoAndWait()
The setContent function was calling fyne.DoAndWait() from the main goroutine, which created a deadlock. Changed to use fyne.Do() (asynchronous) to properly marshal UI updates without blocking. This resolves the error: 'fyne.Do[AndWait] called from main goroutine' The async approach is correct here since we don't need to wait for the content update to complete before continuing.
This commit is contained in:
parent
47f07e3447
commit
684dc961e8
4
main.go
4
main.go
|
|
@ -346,8 +346,8 @@ func (s *appState) setContent(body fyne.CanvasObject) {
|
|||
s.window.SetContent(container.NewMax(bg, body))
|
||||
}
|
||||
|
||||
// Always marshal content changes onto the Fyne UI thread
|
||||
fyne.DoAndWait(update)
|
||||
// Use async Do() instead of DoAndWait() to avoid deadlock when called from main goroutine
|
||||
fyne.Do(update)
|
||||
}
|
||||
|
||||
// showErrorWithCopy displays an error dialog with a "Copy Error" button
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user