M
Matthias Kaeppler
Hi,
it might be a stupid question, but i'll take the chance and ask:
void connect() {
std::string str;
// ...
some_signal.connect(
bind(mem_fun(some_obj, &SomeObj::signal_handler), str));
}
void SomeObj::signal_handler(const std::string &str) {
std::cout << str << std::endl; // does this segfault?
}
I used the sigc syntax in the example code, but it's really a question
which applies to the technique of binding variables in general.
Will cout'ing the string in the signal handler fail because str is
already destroyed, or will it continue living because it's copied and
reference counted?
Thanks,
Matthias
it might be a stupid question, but i'll take the chance and ask:
void connect() {
std::string str;
// ...
some_signal.connect(
bind(mem_fun(some_obj, &SomeObj::signal_handler), str));
}
void SomeObj::signal_handler(const std::string &str) {
std::cout << str << std::endl; // does this segfault?
}
I used the sigc syntax in the example code, but it's really a question
which applies to the technique of binding variables in general.
Will cout'ing the string in the signal handler fail because str is
already destroyed, or will it continue living because it's copied and
reference counted?
Thanks,
Matthias