Skip to content

fix(Windows): Handle thread WM_QUIT and fix message dispatch#100

Merged
ReenigneArcher merged 1 commit into
masterfrom
fix/windows/handle-thread-WM_QUIT
Mar 23, 2026
Merged

fix(Windows): Handle thread WM_QUIT and fix message dispatch#100
ReenigneArcher merged 1 commit into
masterfrom
fix/windows/handle-thread-WM_QUIT

Conversation

@ReenigneArcher

Copy link
Copy Markdown
Member

Description

Change tray_loop to read from the thread message queue (use NULL hwnd) and check GetMessage/PeekMessage return values before dispatching. This prevents DispatchMessage from being called with an uninitialized MSG and ensures WM_QUIT posted to the thread queue is observed (returns -1 or 0 appropriately). Also add a unit test (TestTrayLoopHandlesThreadQuitMessage) that posts WM_QUIT and verifies tray_loop detects the quit message.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

Change tray_loop to read from the thread message queue (use NULL hwnd) and check GetMessage/PeekMessage return values before dispatching. This prevents DispatchMessage from being called with an uninitialized MSG and ensures WM_QUIT posted to the thread queue is observed (returns -1 or 0 appropriately). Also add a unit test (TestTrayLoopHandlesThreadQuitMessage) that posts WM_QUIT and verifies tray_loop detects the quit message.
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Mar 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.06%. Comparing base (7936cb3) to head (de03b6e).
⚠️ Report is 43 commits behind head on master.

Files with missing lines Patch % Lines
src/tray_windows.c 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #100      +/-   ##
==========================================
+ Coverage   65.79%   73.06%   +7.27%     
==========================================
  Files           4        4              
  Lines         421      427       +6     
  Branches       81       83       +2     
==========================================
+ Hits          277      312      +35     
+ Misses         95       72      -23     
+ Partials       49       43       -6     
Flag Coverage Δ
Linux 60.00% <ø> (ø)
Windows 71.56% <57.14%> (?)
libappindicator3-dev 60.00% <ø> (ø)
libayatana-appindicator3-dev 60.00% <ø> (ø)
macOS 64.42% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/tray_windows.c 80.66% <57.14%> (+17.23%) ⬆️

@ReenigneArcher ReenigneArcher merged commit c7f0496 into master Mar 23, 2026
16 checks passed
@ReenigneArcher ReenigneArcher deleted the fix/windows/handle-thread-WM_QUIT branch March 23, 2026 02:57
@github-actions

Copy link
Copy Markdown

Screenshot Comparison

PR #100 screenshots vs screenshots baseline.

Matrix: Linux-libappindicator3-dev

Image Baseline PR
tray_icon_initial.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_shown.png
tray_notification_displayed.png

Matrix: Linux-libayatana-appindicator3-dev

Image Baseline PR
tray_icon_initial.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_shown.png
tray_notification_displayed.png

Matrix: Windows

Image Baseline PR
tray_icon_initial.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_shown.png
tray_notification_displayed.png

Matrix: macOS

Image Baseline PR
tray_icon_initial.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_shown.png
tray_notification_displayed.png

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.

1 participant