Skip to content

Systray icon could not be changed dynamically#110

Merged
joesis merged 2 commits intogetlantern:masterfrom
ksubileau:patch-1
Dec 6, 2019
Merged

Systray icon could not be changed dynamically#110
joesis merged 2 commits intogetlantern:masterfrom
ksubileau:patch-1

Conversation

@ksubileau
Copy link
Contributor

There is an issue with the SetIcon method that make impossible to change the systray icon.

This is because when you call the SetIcon method with a different byte array, the icon will get written to a file with a constant name (systray.ico).
Then the icon is retrieved from the walk's ResourceManager, but this manager cache the icon according its name (see https://github.com/lxn/walk/blob/master/resourcemanager.go#L88). So the written file will not be read on the second call of SetIcon.

The proposed fix consist to compute the MD5 hash of the icon's byte array and use this hash to uniquely name the temporary icon file. Also the file will not be written if the icon was already loaded in memory.

@ksubileau ksubileau marked this pull request as ready for review December 5, 2019 19:10
@lxoo
Copy link

lxoo commented Dec 5, 2019

Noticed this when upgrading a few days ago, went back to the commit before the walk rewrite. Thank you!

@joesis joesis merged commit 6658a36 into getlantern:master Dec 6, 2019
@ksubileau ksubileau deleted the patch-1 branch December 8, 2019 14:50
@oxtoacart
Copy link
Contributor

Thanks @ksubileau !

@getlantern getlantern deleted a comment from joesis Mar 1, 2021
ropog3ovomou pushed a commit to ropog3ovomou/systray that referenced this pull request Jul 13, 2022
Systray icon could not be changed dynamically
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.

4 participants