-
-
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
Windows: Systray: The current process has used all of its system allowance of handles for Window Manager objects #3760
Comments
Confirmed locally |
Looks like the reset of the menu is leaking window handles (as your error rather implied) If you are able to test then the func resetMenu() {
const MF_BYCOMMAND = 0x00000000
for id, res := range wt.menus {
_, _, _ := pDeleteMenu.Call(
uintptr(res),
uintptr(id),
MF_BYCOMMAND,
)
}
wt.createMenu()
} |
I've add
Fixes the system allowance for handles issue. But still get this after around 5 minutes:
|
Thanks, I think maybe it was a too naïve fix. Will dig into it a bit more, perhaps we are leaking multiple handles, or maybe delete needs to be called in a certain way. |
Would using DestroyMenu work? u32 = windows.NewLazySystemDLL("User32.dll")
var pDestroyMenu = u32.NewProc("DestroyMenu")
func resetMenu() {
log.Println("systray: resetMenu")
_, _, _ = pDestroyMenu.Call(uintptr(wt.menus[0]))
wt.visibleItems = make(map[uint32][]uint32)
wt.menus = make(map[uint32]windows.Handle)
wt.menuOf = make(map[uint32]windows.Handle)
wt.menuItemIcons = make(map[uint32]windows.Handle)
wt.createMenu()
} |
With the changes above, I can't reproduce any of the issues. |
Thanks, can you check out the PR and see if that's correct now? |
Looks good. Can't reproduce the handle issues. |
Thanks for your help, this is now merged on develop |
Checklist
Describe the bug
Systray Menu becomes unresponsive. The following line is logged:
systray error: unable to addOrUpdateMenuItem: The current process has used all of its system allowance of handles for Window Manager objects.
How to reproduce
systray error: unable to addOrUpdateMenuItem: The current process has used all of its system allowance of handles for Window Manager objects.
Screenshots
No response
Example code
Fyne version
2.3.2
Go compiler version
1.20
Operating system and version
Windows 11
Additional Information
No response
The text was updated successfully, but these errors were encountered: