2

Closed

Bug in 'merge' method

description

Hi,

It seems that merge method isn't working as expected. A simple example:
std::vector<int> lVector;

auto lObservable = 
        rxcpp::from( rxcpp::Iterate( lVector ) )
             .merge( rxcpp::from( rxcpp::Never<int>( ) ) );
    
lObservable.subscribe( []( int ) {}, []( ) { OutputDebugString( L"Completed1" ); } );
lObservable.subscribe( []( int ) {}, []( ) { OutputDebugString( L"Completed2" ); } );
lObservable.subscribe( []( int ) {}, []( ) { OutputDebugString( L"Completed3" ); } );
lObservable.subscribe( []( int ) {}, []( ) { OutputDebugString( L"Completed4" ); } );
Output:
"Completed2"

An observable created from merge method should only complete when all input sequences
complete and rxcpp::Never<int>( ) never completes. It seems to be a bug especially that this problem occurs only for the second subscriber.
Closed Feb 20, 2014 at 3:21 PM by kirkshoop

comments

kirkshoop wrote Feb 20, 2014 at 3:02 PM

Thanks! I confirmed and added a failing unit test. I'll take a look at a fix.

kirkshoop wrote Feb 20, 2014 at 3:18 PM

Okay fix pushed to codeplex. State was being shared across subscriptions, other operators may have the same bug.

Thanks for the report!