Skip to content
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

Unable to run application twice, even after quitting first one #3063

Open
J7mbo opened this issue Jun 12, 2022 · 7 comments
Open

Unable to run application twice, even after quitting first one #3063

J7mbo opened this issue Jun 12, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@J7mbo
Copy link

J7mbo commented Jun 12, 2022

Describe the bug:

An app cannot be stopped and either started again or replaced with a new, working instance of an app.

When starting an app and showing a window, quitting it, and trying to start the app again, no window is shown the second time. The app cannot be run twice even when the first instance of it is removed. Code provided below shows this in a minimally reproducible example.

Looks like the code at L69 of the loop blocks on the second run and doesn't go any further with debugging. Andrew from slack reckons "It's possible we don't signal funcQueue".

Suspected related issue.

To Reproduce:

Expectation from the following code is that a window should appear repeatedly, but it is only shown once. The same issue happens even with app.New() placed within the loop.

a := app.New()

for {
  w := a.NewWindow("title")
  w.Resize(fyne.Size{Width: 800, Height: 600})
  
  go func() {
    time.Sleep(2 * time.Second)
    a.Quit()
  }()
  
  w.ShowAndRun()
  time.Sleep(4 * time.Second)
}

Device (please complete the following information):

  • OS: MacOS
  • Version: 1.4
  • Go version: 1.18.3
  • Fyne version: 2.2.0
@J7mbo J7mbo added the unverified A bug that has been reported but not verified label Jun 12, 2022
@andydotxyz
Copy link
Member

The second delay should probably be > 2sec as it takes more than a 0 time for the quit to execute and completely shut down an app instance.

@J7mbo
Copy link
Author

J7mbo commented Jun 21, 2022

Thanks Andy, I updated the example code above to 4 seconds and the issue still exists.

@andydotxyz
Copy link
Member

I thought it would, but good to check!

@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels Jun 21, 2022
@andydotxyz
Copy link
Member

This likely relates to #920 - but this issue is a clear description that applies to more OS.

@J7mbo
Copy link
Author

J7mbo commented Jun 25, 2022

Possibly related to #639?

@J7mbo
Copy link
Author

J7mbo commented Mar 21, 2023

Hi Andy, although this was almost a year ago, was the root cause of this ever found? Any way to restart without completely stopping the binary?

@andydotxyz
Copy link
Member

I think you can follow the chain of issues to a PR that was opened but never completed.
It's not a big mystery why it happens, the app is a singleton and is designed to only run once. To add support for multiple runtimes is not a simple bugfix I expect it will have ramifications wider.
We didn't pursue it further as the priority isn't high.
Can you not operate with a single app that remains running, but using windows that appear and disappear?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants