-
-
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
panic: interface conversion: fyne.Layout is nil, not *widget.ListLayout #3369
Comments
I think the crash varies based on the Fyne version. Can you see if this alternative fix helps? index 51671ce6..6c4c71f7 100644
--- a/widget/list.go
+++ b/widget/list.go
@@ -111,6 +111,10 @@ func (l *List) scrollTo(id ListItemID) {
// Resize is called when this list should change size. We refresh to ensure invisible items are drawn.
func (l *List) Resize(s fyne.Size) {
l.BaseWidget.Resize(s)
+ if l.scroller == nil {
+ return
+ }
+
l.offsetUpdated(l.scroller.Offset)
l.scroller.Content.(*fyne.Container).Layout.(*listLayout).updateList(true)
} |
I think that in 2.2.x to 2.3.x the code changed so the fix I suggested does resolve the issue for our next release. Opening PR accordingly. |
This was fixed a while back. Closing |
I can confirm this is still an issue on fyne 2.3.5 - is there reason to believe it was fixed after that point? Panic backtrace:
In CreateRenderer we have: l.scroller = widget.NewVScroll(layout)
layout.Layout = newListLayout(l) So there is a time when scroller is not nil, but Layout is not set. But in Resize we only check if if l.scroller == nil {
return
}
l.offsetUpdated(l.scroller.Offset)
l.scroller.Content.(*fyne.Container).Layout.(*listLayout).updateList(true) |
Please update to
Please try not to be sarcastic - we would not close the ticket if we didn't believe the fix had resolved the issue. |
I was not being sarcastic - I was asking if you thought it might be fixed in 2.4+, which you've confirmed it might be. |
The issue was closed because #3453 was merged saying that it fixed the issue. If anything, the issue should be fixed with v2.4.0. v2.3.5 is no longer the latest version so testing with it doesn't help much honestly |
Checklist
Describe the bug
This panic happens intermittently when my app is starting. Unfortunately I only have a picture of the stacktrace right now:
The panic is here:
The layout is supposed to be set by CreateRenderer:
So it appears that Resize can be called before CreateRenderer - in which case I think we should probably just check that the Layout is not null in Resize() before trying to update it?
How to reproduce
Included code sample causes the panic
Screenshots
No response
Example code
Fyne version
2.2.3
Go compiler version
1.19.1
Operating system
Windows
Operating system version
Windows 10
Additional Information
No response
The text was updated successfully, but these errors were encountered: