Skip to content

Conversation

tyhenry
Copy link

@tyhenry tyhenry commented Apr 16, 2020

this fixes a bug where signal argument types with move c'tors (i.e. std::string, std::vector, etc.) would be invalidated by the first callback.

e.g.

signal<void(std::string)> signalStr;

int i = 0;
auto fn = [&i](std::string s) { std::cout << ++i << ": " << s << std::endl; };
signalStr.connect( fn );
signalStr.connect( fn );

std::string str = "hello";
signalStr( str );

/*

before fix:

1: hello
2: 

after fix:

1: hello
2: hello

*/

… prevent move c'tor invalidation, e.g. signal(std::string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant