From c7de35be5dc31785984f9b3c6b21f7bf46a05034 Mon Sep 17 00:00:00 2001 From: Andrei Lebedev Date: Fri, 11 May 2018 08:22:09 +0300 Subject: Replace shared_ptr with move ctor --- Rx/v2/src/rxcpp/rx-scheduler.hpp | 11 +++++++++-- 1 file 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 reset(const recurse& r) const { + exit_recursed_scope_type reset(const recurse& r) const { requestor = std::addressof(r.get_recursed()); - return std::make_shared(this); + return exit_recursed_scope_type(this); } bool is_recursed() const { return !!requestor; -- cgit v1.2.3