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

Add support for removing a menu item #34

Merged
merged 2 commits into from
Jan 16, 2023

Conversation

bdwyertech
Copy link

@bdwyertech bdwyertech commented Dec 19, 2022

Resolves #33 and fyne-io/fyne#3463

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition, thanks.
I think some code is needed for unix as well?

systray_darwin.m Show resolved Hide resolved
@bdwyertech
Copy link
Author

bdwyertech commented Dec 21, 2022

Nice addition, thanks. I think some code is needed for unix as well?

I'll have to give the Unix code a further look. Quick glance says pruning the button ID from a slice and triggering a refresh.

Also, I did notice another memory leak I cannot quite figure out... Seems to be related to the Icon setting code on Darwin specifically. If I use a test harness to delete/create a new MenuItem every few seconds, after a few hours the memory usage multiplies exponentially. pprof nor Datadog show anything. If I remove SetIcon from the loop, the memory does not balloon. My thought is something is not freeing up transient resources, probably something in the cast from CGO -> NSData -> NSImage -> NSMenuItem.image.

@andydotxyz
Copy link
Member

Thanks, do post here if you need more assistance with the unix code.

With regards to icon memory leak, I think that also was reported in our usage in the toolkit at fyne-io/fyne#3463, so you're not the only one to see it. The image data is obviously not being cleaned up in the C code.

@bdwyertech
Copy link
Author

Thanks, do post here if you need more assistance with the unix code.

With regards to icon memory leak, I think that also was reported in our usage in the toolkit at fyne-io/fyne#3463, so you're not the only one to see it. The image data is obviously not being cleaned up in the C code.

Should all be resolved now. Tested the tray on Kali, that dbus system is pretty interesting!

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting Menu Items
2 participants