Skip to content

Conversation

@hut36
Copy link
Contributor

@hut36 hut36 commented Nov 18, 2025

Free handles after stop so that wen can do prevent_display_sleep after stop.


Note

Close Windows power request handles on stop, reset internal state, add drop-based cleanup, and test restarting after stop.

  • Windows handle management:
    • Replace PowerClearRequest with CloseHandle for both system_handle and optional display_handle in nosleep-windows/src/lib.rs.
    • Clear internal state by setting self.no_sleep_handle = None after closing.
  • Lifecycle:
    • Implement Drop for NoSleep to automatically call stop().
  • Tests:
    • Add test_start_after_stop to verify starting after stop().
  • Imports:
    • Add CloseHandle to windows::Win32::Foundation and remove unused power-clear import.

Written by Cursor Bugbot for commit 7df050e. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Copy link
Owner

@pevers pevers left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to fix this! I've a small suggestion to implement it as Drop.

Free handles after stop so that wen can do prevent_display_sleep after
stop.
@hut36
Copy link
Contributor Author

hut36 commented Nov 20, 2025

@pevers, thanks for review! I've updated the PR.

Copy link
Owner

@pevers pevers left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

@pevers pevers merged commit f763780 into pevers:main Nov 20, 2025
8 checks passed
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.

2 participants