CombineCommunity / CombineExt

CombineExt provides a collection of operators, publishers and utilities for Combine, that are not provided by Apple themselves, but are common in other Reactive Frameworks and standards.
https://combine.community
MIT License
1.72k stars 151 forks source link

Fix memory leak in WithLatestFrom #140

Closed TTOzzi closed 2 years ago

TTOzzi commented 2 years ago

Resolves #139

The withLatestFrom stream has been completed, but it has been confirmed that otherSubscription is remaining and causing memory leaks. Modified it to call cancel when WithLatestFrom's Subscription is deinitialized.

codecov[bot] commented 2 years ago

Codecov Report

Merging #140 (67d8ede) into main (1f6b0df) will increase coverage by 0.01%. The diff coverage is 100.00%.

:exclamation: Current head 67d8ede differs from pull request most recent head bcda2ca. Consider uploading reports for the commit bcda2ca to get more accurate results

@@            Coverage Diff             @@
##             main     #140      +/-   ##
==========================================
+ Coverage   95.45%   95.47%   +0.01%     
==========================================
  Files          72       72              
  Lines        4266     4284      +18     
==========================================
+ Hits         4072     4090      +18     
  Misses        194      194              
Impacted Files Coverage Δ
Sources/Operators/WithLatestFrom.swift 96.00% <100.00%> (+0.05%) :arrow_up:
Tests/WithLatestFromTests.swift 98.66% <100.00%> (+0.05%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

adlerj commented 2 years ago

This fix works in the sample project I made

freak4pc commented 2 years ago

Awesome find and fix, thanks for this and for the extra test, too! 🤩