Skip to content

refactor: smart pointers and fix ownership - #167

Merged
ReenigneArcher merged 1 commit into
masterfrom
refactor/sonar-fixes
Jul 28, 2026
Merged

refactor: smart pointers and fix ownership#167
ReenigneArcher merged 1 commit into
masterfrom
refactor/sonar-fixes

Conversation

@ReenigneArcher

Copy link
Copy Markdown
Member

Description

Replace raw pointer members (app, trayIcon, trayTopMenu) with std::unique_ptr in QtTrayMenu. Consolidate tray_qt module-level globals into a State struct accessed via a function-local static. Move tray test fixtures from global arrays into per-fixture instance members to eliminate shared mutable state between tests. Replace std::system shell invocations with posix_spawnp for notification cleanup. Use placement new instead of reinterpret_cast+memcpy for C struct initialization over raw buffers.

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

See our AI usage policy.

  • 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

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.50%. Comparing base (87d324c) to head (1773925).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/tray_qt.cpp 61.11% 2 Missing and 12 partials ⚠️
src/QtTrayMenu.cpp 88.23% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #167      +/-   ##
==========================================
+ Coverage   59.81%   61.50%   +1.68%     
==========================================
  Files           5        5              
  Lines         443      439       -4     
  Branches      162      159       -3     
==========================================
+ Hits          265      270       +5     
+ Misses        121      110      -11     
- Partials       57       59       +2     
Flag Coverage Δ
Linux-qt5 58.66% <67.30%> (+2.20%) ⬆️
Linux-qt6 58.66% <67.30%> (+2.20%) ⬆️
Windows-qt6 58.65% <69.81%> (+2.24%) ⬆️
macOS-qt6 56.79% <60.00%> (+1.26%) ⬆️

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

Files with missing lines Coverage Δ
src/QtTrayMenu.h 100.00% <100.00%> (ø)
src/QtTrayMenu.cpp 68.88% <88.23%> (+2.78%) ⬆️
src/tray_qt.cpp 64.75% <61.11%> (+0.96%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87d324c...1773925. Read the comment docs.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Last Updated 2026-07-28 02:44:36 UTC
Source Run CI Run #740
Commit 1773925bf775632869667ee77fca7adf201ff2df

Screenshot Comparison

PR #167 screenshots vs screenshots baseline.

Matrix: Linux-qt5

Image Baseline PR
tray_icon_ico.png
tray_icon_initial.png
tray_icon_png.png
tray_icon_svg.png
tray_icon_themed.png
tray_icon_update_ico.png
tray_icon_update_png.png
tray_icon_update_svg.png
tray_icon_update_themed.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_left_click.png
tray_menu_shown.png
tray_notification_ico_icon.png
tray_notification_png_icon.png
tray_notification_svg_icon.png
tray_notification_themed_icon.png

Matrix: Linux-qt6

Image Baseline PR
tray_icon_ico.png
tray_icon_initial.png
tray_icon_png.png
tray_icon_svg.png
tray_icon_themed.png
tray_icon_update_ico.png
tray_icon_update_png.png
tray_icon_update_svg.png
tray_icon_update_themed.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_left_click.png
tray_menu_shown.png
tray_notification_ico_icon.png
tray_notification_png_icon.png
tray_notification_svg_icon.png
tray_notification_themed_icon.png

Matrix: Windows-qt6

Image Baseline PR
tray_icon_ico.png
tray_icon_initial.png
tray_icon_png.png
tray_icon_svg.png
tray_icon_themed.png
tray_icon_update_ico.png
tray_icon_update_png.png
tray_icon_update_svg.png
tray_icon_update_themed.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_left_click.png
tray_menu_shown.png
tray_notification_ico_icon.png
tray_notification_png_icon.png
tray_notification_svg_icon.png
tray_notification_themed_icon.png

Matrix: macOS-qt6

Image Baseline PR
tray_icon_ico.png
tray_icon_initial.png
tray_icon_png.png
tray_icon_svg.png
tray_icon_themed.png
tray_icon_update_ico.png
tray_icon_update_png.png
tray_icon_update_svg.png
tray_icon_update_themed.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_left_click.png
tray_menu_shown.png
tray_notification_ico_icon.png
tray_notification_png_icon.png
tray_notification_svg_icon.png
tray_notification_themed_icon.png

Replace raw pointer members (app, trayIcon, trayTopMenu) with std::unique_ptr in QtTrayMenu. Consolidate tray_qt module-level globals into a State struct accessed via a function-local static. Move tray test fixtures from global arrays into per-fixture instance members to eliminate shared mutable state between tests. Replace std::system shell invocations with posix_spawnp for notification cleanup. Use placement new instead of reinterpret_cast+memcpy for C struct initialization over raw buffers.
@sonarqubecloud

Copy link
Copy Markdown

@ReenigneArcher
ReenigneArcher marked this pull request as ready for review July 28, 2026 02:47
@ReenigneArcher
ReenigneArcher merged commit 91a3379 into master Jul 28, 2026
18 checks passed
@ReenigneArcher
ReenigneArcher deleted the refactor/sonar-fixes branch July 28, 2026 02:48
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