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

Notification icon fails to create in some scenarios #5

Closed
Eiyeron opened this issue Jul 2, 2024 · 1 comment · Fixed by #6
Closed

Notification icon fails to create in some scenarios #5

Eiyeron opened this issue Jul 2, 2024 · 1 comment · Fixed by #6
Labels
bug Something isn't working

Comments

@Eiyeron
Copy link
Contributor

Eiyeron commented Jul 2, 2024

Hello, during my tests I noticed that the tray icon (or the notification icon) tends to fail its initialization and triggers the assert in gNotifInit. When that happens, the program can still be "minimized to the icon" (or hidden) that doesn't exist, making it hard to pop it back up.

From my own testing, I'm drawing a conjecture that it looks like it fails to create the icon when there's a remaining one from a previous instance that wasn't properly cleaned up, as if something killed the process to re-run it, like your favorite IDE might do to re-run debugging sessions. Orphaned, those icons are usually deleted once you hover your mouse cursor over them (or having any of the desktop shell crash), fixing the problem in the same time.

I think I might see two ways to "fix" or get around the problem:

  1. Experiment and find a way to reuse the orphaned icon for the new instance instead of directly assert on failure to create the icon
  2. Because killing a process like a debugger or the Task Manager does seems to not trigger standard exit hooks like atexit, there might be a way to hook to the lower level OS' termination functions to detect when the program is going to be kill -9 and destroy the icon at this moment.

I saw some kind of... solution to detect the Task Manager's end task operation but this seems hacky, as in "hijacking an actual system function loaded in the program's memory area" hacky. I'm not sure it'd work when the debugger does the termination (nor the logistics of licensing a code snippet from Stack Overflow) nor if it'd be even tolerated by anti-virus software or software alike, but at least has the merit of existing.

To be fair, this is only mildly annoying, nothing worth breaking a sweat over, it's just a small papercut without any incidence over anything.

Have a nice day.

@jlaumon
Copy link
Owner

jlaumon commented Jul 3, 2024

I've noticed it as well but couldn't repro well enough to investigate a solution. It felt like it usually failed once but the next time worked (so maybe that somehow unregistered the previous icon? I'd need to test properly).

Another option is to register an icon with a different UUID every time, but I didn't want to do that because then they accumulate in the tray.

@jlaumon jlaumon added the bug Something isn't working label Jul 4, 2024
@jlaumon jlaumon closed this as completed in #6 Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants