-
Notifications
You must be signed in to change notification settings - Fork 63
Fix maxSize method to handle nil canvas case in ShowCompletion #112
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
base: master
Are you sure you want to change the base?
Conversation
It sounds more like you are working around a bug somewhere else than a GC cycle garbage collecting an object. What you are describing only happens for weak pointers other than that case, the GC never reclaims objects which have a valid reference to them. Something is setting the object to nil somewhere and causing the crash. |
|
Here's a minimal recreatable example: To recreate the issue, select one of the items from the completion widget, then switch to the second tab. Allow around 5 minutes to pass, then switch back to the original tab. It will crash with the following: Do you see anything that might be useful for understanding why this is happening? From what I can tell, based off this code, I'm not manipulating anything I shouldn't be and don't understand why cnv is nil. Is this perhaps a bug in the main Fyne package? Or perhaps am I filtering incorrectly and it's resulting in this side effect? |
This comment has been minimized.
This comment has been minimized.
|
While I did bail out quickly from that AI generated stuff (please avoid flooding the comments with that in the future), I think you are right. I think I may have read the code incorrectly last time I looked at this. I'll look at how the Entry widget uses CanvasForObject in the code there. |
|
However, I still do not agree with the statement that the object just suddenly becomes |
| if cnv == nil { | ||
| return fyne.NewSize(0, 0) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking into entry and select_entry, it does indeed look like you may wish to check for it being nil. I do however wonder if this function is absolutely necessary? Look at the bottom of select_entry.go in the regular fyne widgets and you'll see that we can just set the height of the dropdown to be MinSize and fyne should crop it automatically at the end of the canvas. Maybe we can solve this issue by refactoring the code to avoid this function entirely instead? :)
|
Yea sorry for the AI stuff, I just figured that was the most effective way of getting the gist across. I was a bit out of my depth. The GC thing was my early speculation, just because it seemed to be very time dependent. |
I’ve been maintaining this patch manually for several years. Without it, if an app tab contains a completion widget, entering data and then leaving the tab idle for around five minutes triggers garbage collection, which clears
cnvand causes a crash when switching back to that tab.I’ve reapplied this fix across many updates and have yet to encounter any negative side effects. Given its stability, I’d like to propose integrating it into the official repository so others can benefit without needing to patch it locally.