ReactiveX / RxCpp

Reactive Extensions for C++
Apache License 2.0
3.05k stars 395 forks source link

Fix exit_recursed_scope_type dtor cleaning requestor early #443

Closed lebdron closed 6 years ago

lebdron commented 6 years ago

Because of disabled RVO, exit_recursed_scope_type destructor was called on return statement in recursed_scope_type::reset, making the call ineffective. This change allows to use it as intended when RVO is disabled.

kirkshoop commented 6 years ago

Thank you!

The shared_ptr<> will undo the performance provided by the recursed pattern. Another approach to try is to make exit_recursed_scope_type moveable and only set that->requestor = nullptr when that != nullptr. The move constructor would make sure that only the destination had that != nullptr

lebdron commented 6 years ago

@kirkshoop Thank you for clarification. I have applied the changes as you have described.

kirkshoop commented 6 years ago

Looks great!