ispringtech / FastSignals

Easy to use, fast and lightweight C++17 signals and slots library, drop-in replacement for the Boost.Signals2
MIT License
25 stars 10 forks source link

shared_connection_block should unblock in its destructor #29

Closed KonstantinGeist closed 5 years ago

KonstantinGeist commented 5 years ago

Boost:

A shared_connection_block releases its block when it is destroyed or its unblock method is called.

The following simple test case fails:

callbackCalled = false;
event(value);
CHECK(callbackCalled);

{
    callbackCalled = false;
    shared_connection_block block(conn);
    event(value);
    CHECK(!callbackCalled);
}

callbackCalled = false;
event(value);
CHECK(callbackCalled); // <-- fails here because the connection is still blocked

shared_connection_block doesn't have a destructor to unblock its connection, and none of the existing test cases cover this simple scenario.

In this PR I simply add unblock() to the destructor.

Warboss-rus commented 5 years ago

Merged, thanks!