diff options
Diffstat (limited to 'Rx/v2/src/rxcpp/rx-scheduler.hpp')
-rw-r--r-- | Rx/v2/src/rxcpp/rx-scheduler.hpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 8bdb4dd..dbf6cb2 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -458,12 +458,19 @@ class schedulable : public schedulable_base public: ~exit_recursed_scope_type() { + if (that != nullptr) { that->requestor = nullptr; + } } exit_recursed_scope_type(const recursed_scope_type* that) : that(that) { } + exit_recursed_scope_type(exit_recursed_scope_type && other) /*noexcept*/ + : that(other.that) + { + other.that = nullptr; + } }; public: recursed_scope_type() @@ -480,9 +487,9 @@ class schedulable : public schedulable_base // no change in recursion scope return *this; } - std::shared_ptr<exit_recursed_scope_type> reset(const recurse& r) const { + exit_recursed_scope_type reset(const recurse& r) const { requestor = std::addressof(r.get_recursed()); - return std::make_shared<exit_recursed_scope_type>(this); + return exit_recursed_scope_type(this); } bool is_recursed() const { return !!requestor; |