Smithay / calloop

A callback-based Event Loop
MIT License
177 stars 34 forks source link

Fix crash when dropping removed token #155

Closed chrisduerr closed 9 months ago

chrisduerr commented 9 months ago

This fixes an issue where calloop would crash internally when the PostAction::Drop was invoked after the user manually cancelled the source in the callback.

codecov[bot] commented 9 months ago

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (7ae6f36) 86.84% compared to head (d4e9304) 86.75%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #155 +/- ## ========================================== - Coverage 86.84% 86.75% -0.10% ========================================== Files 14 14 Lines 1817 1819 +2 ========================================== Hits 1578 1578 - Misses 239 241 +2 ``` | [Flag](https://app.codecov.io/gh/Smithay/calloop/pull/155/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay) | Coverage Δ | | |---|---|---| | [macos-latest](https://app.codecov.io/gh/Smithay/calloop/pull/155/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay) | `85.79% <74.57%> (-0.11%)` | :arrow_down: | | [ubuntu-latest](https://app.codecov.io/gh/Smithay/calloop/pull/155/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay) | `86.28% <74.57%> (-0.10%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/Smithay/calloop/pull/155?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay) | Coverage Δ | | |---|---|---| | [src/loop\_logic.rs](https://app.codecov.io/gh/Smithay/calloop/pull/155?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay#diff-c3JjL2xvb3BfbG9naWMucnM=) | `87.03% <74.57%> (-0.51%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

elinorbgr commented 9 months ago

Could you give a quick summary of what you changed and why? This diff is not very clear to read...

chrisduerr commented 9 months ago

Could you give a quick summary of what you changed and why? This diff is not very clear to read...

Just changed the remove to try_remove. Just also tried to make the code somewhat readable at least.

kchibisov commented 9 months ago

This probably needs a test given that it sounds like simple to repro?

elinorbgr commented 9 months ago

Alright, I took the time to figure out exactly what happens, and this seems like a good way to fix this, thanks.

Could you please just add a changelog entry for this under the "unreleased" section?

elinorbgr commented 9 months ago

Ok so, it appears that a deeper issue with this PR as a special case was found & fixed in #156.

elinorbgr commented 9 months ago

closing in favor of #156