We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
to reproduce
for(int i=1;i<100;i++) std::thread(test1).detach();
void test1() { Timer t = Timer(); t.setInterval([&](){ }, 1000); t.stop(); }
results Exception has occurred. Segmentation fault
The text was updated successfully, but these errors were encountered:
yes, I think active variable is useless
Sorry, something went wrong.
Because the Timer is destroyed after t.stop(), and the thread inside the setInterval function uses the Timer after the destruction.
An idea: Timer inherits std::enable_shared_from_this to extend the life cycle of Timer until the thread inside setInterval function ends.
Modified code: timerrcpp.h
test program: test.cpp
No branches or pull requests
to reproduce
results
Exception has occurred.
Segmentation fault
The text was updated successfully, but these errors were encountered: