-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fyne window becomes unresponsive when in background for a while #2791
Comments
Do you think you could try to include the full stack-trace? It should hopefully give a more detailed answer to where the actual panic happened. |
Do you have instructions for capturing the stack trace? |
Ah, sorry. I thought you meant it crashed but I see now that it clearly doesn't. Getting a stack trace without it crashing is not really possible (without a debugger, see resonate further down), I think. |
I was able to reproduce it semi-intentionally. I'm updating the issue |
You could run the application in delve and get the backtrace for all the running goroutine. I think you could even put a break point on where this error is happening to get a good stack trace. |
Thanks for the link, but I think they are less related than seems. The previous issue related to our caches, but this one may relate to OpenGL context being reset/removed... The stack trace will really help |
this is the stack trace when i hit the breakpoint on the exception
|
Let me know if i can do more to get this problem solved. |
I've experienced this issue on Ubuntu 20.04 and Fedora 35. This minimal example is enough to (intermittently) reproduce it for me. package main
import (
"fmt"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
entry := widget.NewEntry()
w := a.NewWindow("Hello World")
w.Show()
w.SetContent(entry)
a.Lifecycle().SetOnEnteredForeground(func() {
fmt.Println("before")
fyne.CurrentApp().Driver().CanvasForObject(entry).Focus(entry)
fmt.Println("after")
})
a.Run()
} Most of the time both the "before" and "after" messages are emitted, and focus is assigned to the entry widget. However about 1 in 5 times
|
A similar problem. I use the application on android as a way to launch a local service. But over time, the service closes itself, causing the automatic destruction of the application. ...
func main() {
a := app.New()
w := a.NewWindow("app")
rootPath := a.Storage().RootURI().Path()
gPath = strings.Split(rootPath, "/fyne/")[0] + "/hidden_lake"
w.SetContent(container.New(
layout.NewCenterLayout(),
container.NewVBox(
widget.NewLabel("Hidden Lake Messenger"),
buttonActions(a),
),
))
w.SetOnClosed(func() { destructApp() })
w.ShowAndRun()
}
... |
I think this issue (the original issue on MacOS) has been resolved. @kheyse-oqton @pekim does this still reproduce for you (assuming you are still using Fyne?) @number571 if you're having a different issue on Android could you open a new ticket? |
To run a background service on Android you will need to use the platform specific APIs unfortunately. Long running code spawned from a GUI will be killed by the OS. That is a feature of their sandbox. We intend to add a background API at some point, but that is not related to this bug report. |
Thanks, got it. It would be really convenient to create services in the background of the mobile OS, in the likeness of VPN services, anonymization services and other things exclusively using Go. |
I agree with the extra comments but am closing as complete as per @dweymouth suggestion. |
Describe the bug:
Fyne window becomes unresponsive, can not regain focus.
Happens consistently, most likely because the app is running in the background for a while.
Console shows:
Seems to be really similar to #2536
To Reproduce:
Open the app.
Wait a few hours running the app in the background (trying to figure out some more strict conditions to reproduce the problem)
Or:
Disconnect laptop from external screen and put laptop to sleep. When reconnecting to external screen and waking up, the window is unresponsive and the error is logged.
Does not seem to happen every time though. Or may depend on the exact order of operations.
Example code:
Currently known to happen with my own code (shows window with ShowAndRun) and with
go run fyne.io/fyne/v2/cmd/fyne_demo
Device (please complete the following information):
The text was updated successfully, but these errors were encountered: