Commit 05e60667 authored by Marian Triebe's avatar Marian Triebe

Fix segfault with `sync_send`

This segfault occurred without `then`. closes #325
parent 7ede7f2a
...@@ -619,7 +619,7 @@ resumable::resume_result local_actor::resume(execution_unit* eu, ...@@ -619,7 +619,7 @@ resumable::resume_result local_actor::resume(execution_unit* eu,
} }
int handled_msgs = 0; int handled_msgs = 0;
auto reset_timeout_if_needed = [&] { auto reset_timeout_if_needed = [&] {
if (handled_msgs > 0) { if (handled_msgs > 0 && has_behavior()) {
request_timeout(get_behavior().timeout()); request_timeout(get_behavior().timeout());
} }
}; };
......
...@@ -503,4 +503,24 @@ CAF_TEST(sync_send) { ...@@ -503,4 +503,24 @@ CAF_TEST(sync_send) {
); );
} }
behavior snyc_send_no_then_A(event_based_actor * self) {
return [=](int number) {
CAF_MESSAGE("got " << number);
self->quit();
};
}
behavior snyc_send_no_then_B(event_based_actor * self) {
return {
[=](int number) {
self->sync_send(self->spawn(snyc_send_no_then_A), number);
self->quit();
}
};
}
CAF_TEST(sync_send_no_then) {
anon_send(spawn(snyc_send_no_then_B), 8);
}
CAF_TEST_FIXTURE_SCOPE_END() CAF_TEST_FIXTURE_SCOPE_END()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment