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
4f68fe39f8
commit
3e0d30d425
4
main.go
4
main.go
|
|
@ -346,8 +346,8 @@ func (s *appState) setContent(body fyne.CanvasObject) {
|
||||||
s.window.SetContent(container.NewMax(bg, body))
|
s.window.SetContent(container.NewMax(bg, body))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always marshal content changes onto the Fyne UI thread
|
// Use async Do() instead of DoAndWait() to avoid deadlock when called from main goroutine
|
||||||
fyne.DoAndWait(update)
|
fyne.Do(update)
|
||||||
}
|
}
|
||||||
|
|
||||||
// showErrorWithCopy displays an error dialog with a "Copy Error" button
|
// showErrorWithCopy displays an error dialog with a "Copy Error" button
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user