-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: Copy and send notification when user click "This device" menu #9
Conversation
This possibly makes goroutine leak since this part is called multiple times. |
the fix might be a bit complicated for now |
main.go
Outdated
@@ -131,6 +138,30 @@ func onReady() { | |||
mDisconnect.Enable() | |||
systray.SetIcon(iconOn) | |||
enabled = true | |||
|
|||
go func(mThisDevice *systray.MenuItem) { |
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.
If this part is passed twice, goroutine is created two.
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.
🤔 Let me debug it again
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.
building...
running...
ts-called goroutine id: 1634266073 # first loop cycle
# I made-up error intentionally (dynamically without closing program) on tailscale exec call, this will send "closing" signal to enabledCh
ts-closed goroutine id: 1634266073 # this goroutine close was triggered by enabledCh
# I remove the made-up error
ts-called goroutine id: 1634266103 # The click listener active again after if !enable { enable = true }
^Ccleaning...
see you again~
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.
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.
The groutine part should be moved out of for loop.
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.
Is it like this?
Lines 72 to 80 in a06d2c1
systray.AddSeparator() | |
mAdminConsole := systray.AddMenuItem("Admin Console...", "") | |
go func() { | |
for { | |
_, ok := <-mAdminConsole.ClickedCh | |
if !ok { | |
break | |
} | |
openBrowser("https://login.tailscale.com/admin/machines") |
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.
🤦♂️ wrong commit message
Probably LGTM. Will look tonight. |
Thank you |
No description provided.