Skip to content

Ensures task completion before resource disposal#20

Merged
magicxor merged 4 commits intomasterfrom
feature/wait-tasks-before-dispose
Nov 24, 2025
Merged

Ensures task completion before resource disposal#20
magicxor merged 4 commits intomasterfrom
feature/wait-tasks-before-dispose

Conversation

@magicxor
Copy link
Owner

Waits for mouse hook and event processing tasks to complete
before disposing resources during shutdown. This prevents
potential resource contention and ensures a clean shutdown.
Adds logging for task completion and timeout scenarios.

Waits for mouse hook and event processing tasks to complete
before disposing resources during shutdown. This prevents
potential resource contention and ensures a clean shutdown.
Adds logging for task completion and timeout scenarios.
Copilot AI review requested due to automatic review settings November 24, 2025 00:43
@magicxor magicxor self-assigned this Nov 24, 2025
@magicxor magicxor added the enhancement New feature or request label Nov 24, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the Dispose method in MainViewModel to ensure that background tasks complete before disposing underlying resources. It adds synchronous waiting with timeout handling for two background tasks (_updateMouseHookRectsLoopTask and _mouseEventProcessingLoopTask) that process mouse events, along with comprehensive logging for completion and error scenarios.

Key Changes:

  • Adds task completion waiting with 5-second timeouts before disposing resources
  • Implements exception handling for OperationCanceledException and other errors during task shutdown
  • Suppresses VSTHRD002 warning with justification for synchronous waiting in Dispose context

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Nov 24, 2025

@magicxor I've opened a new pull request, #21, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits November 24, 2025 09:06
* Initial plan

* Extract duplicated task waiting logic into WaitForTaskCompletion helper method

Co-authored-by: magicxor <8275793+magicxor@users.noreply.github.com>

* Update WinSyncScroll/ViewModels/MainViewModel.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: magicxor <8275793+magicxor@users.noreply.github.com>
Co-authored-by: Ilia Burakov <magicxor@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings November 24, 2025 01:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings November 24, 2025 01:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@magicxor magicxor merged commit d7b693f into master Nov 24, 2025
9 checks passed
@magicxor magicxor deleted the feature/wait-tasks-before-dispose branch November 24, 2025 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants