summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirk Shoop <kirk.shoop@microsoft.com>2017-04-10 22:33:25 -0700
committerGitHub <noreply@github.com>2017-04-10 22:33:25 -0700
commitb41b15f1daf97519433742ff86adad9d0ae8acdd (patch)
treec757bdadd68ab444a556aa6e6a7476a516af4a65
parent201dd99b6494564c9e8990d0a5c32b23431128d4 (diff)
downloadRxCpp-b41b15f1daf97519433742ff86adad9d0ae8acdd.tar.gz
fix async lifetime in window_toggle (#372)
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp4
-rw-r--r--Rx/v2/test/operators/window_toggle.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp b/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp
index 1460feb..c17d4bc 100644
--- a/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp
+++ b/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp
@@ -120,6 +120,8 @@ struct window_toggle
localState->dest.remove(innerscope);
});
+ localState->dest.add(localState->cs);
+
auto source = on_exception(
[&](){return localState->coordinator.in(localState->openings);},
localState->dest);
@@ -252,7 +254,7 @@ struct window_toggle
static subscriber<T, observer_type> make(dest_type d, window_toggle_values v) {
auto cs = composite_subscription();
- auto coordinator = v.coordination.create_coordinator();
+ auto coordinator = v.coordination.create_coordinator(d.get_subscription());
return make_subscriber<T>(cs, observer_type(this_type(cs, std::move(d), std::move(v), std::move(coordinator))));
}
diff --git a/Rx/v2/test/operators/window_toggle.cpp b/Rx/v2/test/operators/window_toggle.cpp
index fc9088b..b85c1ba 100644
--- a/Rx/v2/test/operators/window_toggle.cpp
+++ b/Rx/v2/test/operators/window_toggle.cpp
@@ -35,7 +35,7 @@ SCENARIO("window toggle, basic", "[window_toggle][operators]"){
WHEN("ints are split into windows"){
using namespace std::chrono;
-
+
int wi = 0;
auto res = w.start(
@@ -310,7 +310,7 @@ SCENARIO("window toggle, disposed", "[window_toggle][operators]"){
THEN("there was one subscription and one unsubscription to the observable"){
auto required = rxu::to_vector({
- o_on.subscribe(200, 590)
+ o_on.subscribe(200, 420)
});
auto actual = xs.subscriptions();
REQUIRE(required == actual);