Fix vanishing system tray icon#869
Merged
sabrogden merged 1 commit intosabrogden:masterfrom Jun 15, 2025
dcog989:fix-vanishing-system-tray-icon
Merged
Fix vanishing system tray icon#869sabrogden merged 1 commit intosabrogden:masterfrom dcog989:fix-vanishing-system-tray-icon
sabrogden merged 1 commit intosabrogden:masterfrom
dcog989:fix-vanishing-system-tray-icon
Conversation
sabrogden
approved these changes
Jun 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When Ditto starts, if "Display icon in system tray" option is disabled in the settings, we show tray icon for 40 seconds before hiding it.
The Problem
The timer's handler in CMainFrame::OnTimer unconditionally hides the tray icon when it fires after 40 seconds. It does not re-check the current state of the "Display icon in system tray" option.
Race Condition
If a user opens the options dialog within that 40-second window, enables the tray icon, and clicks "OK" or "Apply", the icon is correctly shown. However, the original 40-second timer is still active. When it fires, it executes m_trayIcon.Hide() regardless of the user's recent setting change, causing the icon to disappear unexpectedly.
More?
I think there may be another issue which I haven't found but this fix seems reasonable. Tested and all good.