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

Migrate to the new threading model more gently #5411

Closed
7 tasks done
andydotxyz opened this issue Jan 14, 2025 · 4 comments
Closed
7 tasks done

Migrate to the new threading model more gently #5411

andydotxyz opened this issue Jan 14, 2025 · 4 comments
Labels
bug Something isn't working races Issues relating to race condition in Fyne

Comments

@andydotxyz
Copy link
Member

andydotxyz commented Jan 14, 2025

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

As pointed out by some of our testers, an app that has any amount of background processing will probably crash on basic usage when upgrading to v2.6.0.

How to reproduce

Run on develop and include in your app this minimal code:

go func() {
    w.setTitle("Crash on some systems")
}

Screenshots

No response

Example code

go func() {
    w.setTitle("Crash on some systems")
}

Fyne version

v2.6.0-pre

Go compiler version

all

Operating system and version

macOS particularly, but many variants

Additional Information

Plan:

@andydotxyz andydotxyz added the unverified A bug that has been reported but not verified label Jan 14, 2025
@andydotxyz
Copy link
Member Author

Linking this to the parent ticket as well #4654

@andydotxyz andydotxyz mentioned this issue Jan 14, 2025
17 tasks
@andydotxyz
Copy link
Member Author

andydotxyz commented Jan 14, 2025

So far I have a utility function that we can use appropriately:

func EnsureMain(fn func()) {
	if build.DisableThreadChecks || IsMainGoroutine() {
		fn()
		return
	}

	// logging code here too
	fyne.Do(fn)
}

And I propose log output along the lines of:

2025/01/14 22:18:59 *** Error in Fyne call thread, this should have been called in fyne.Do ***
2025/01/14 22:18:59   At: /Users/andy/Code/Fyne/fyne/cmd/hello/main.go:21

If this looks like a good start I can open a PR for that which will avoid a lot of crashes, then we can look at how it would be applied wider and also how to disable it for the project once people have ported over

@Jacalz
Copy link
Member

Jacalz commented Jan 16, 2025

As noted in #5420, we need to wait with moving internal maps over because it will cause crashes for anyone with old code still updating elements in goroutines.

@Jacalz Jacalz added bug Something isn't working races Issues relating to race condition in Fyne and removed unverified A bug that has been reported but not verified labels Jan 18, 2025
@andydotxyz
Copy link
Member Author

The main points are all delivered now :)

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

No branches or pull requests

2 participants