pbhogan/Signals — pull request #4 by Andreyul (2012-10-13 15:41:38+00:00)
Title: Support for disconnecting a signal while its Emit() is in progress

Calling Disconnect() on an emitted signal causes crash because the iterator of delegateList becomes invalid after erasing element from std::set. I have changed the code and now the iterator remains valid.

Test code below:

```c++
#include
#include "Signal.h"
using namespace Gallant;

class Foo
{
public:
Signal0< void > signal;

void Action1( void )
{
signal.Connect(this, &Foo::Slot1);
signal();
}

void Slot1( void )
{
printf("Foo::slot1\n");
}

void Action2( void )
{
signal.Connect(this, &Foo::Slot2);
signal();
}

void Slot2( void )
{
printf("Foo::slot2\n");
signal.Disconnect(this, &Foo::Slot2); // crash here
}
};

int main()
{
Foo foo;

foo.Action1(); // Slot 1 is connected and emitted, ok
foo.signal.Clear();
printf("test 1 passed\n");

foo.Action2(); // Slot 2 is connected and emitted, crash
printf("test 2 passed\n");

return 0;
}
```