Commit c83791db authored by Dominik Charousset's avatar Dominik Charousset

Fix possible stack overflow in ~attachable

parent 5a471181
...@@ -22,7 +22,14 @@ ...@@ -22,7 +22,14 @@
namespace caf { namespace caf {
attachable::~attachable() { attachable::~attachable() {
// nop // Avoid recursive cleanup of next pointers because this can cause a stack
// overflow for long linked lists.
using std::swap;
while (next != nullptr) {
attachable_ptr tmp;
swap(next->next, tmp);
swap(next, tmp);
}
} }
attachable::token::token(size_t typenr, const void* vptr) attachable::token::token(size_t typenr, const void* vptr)
......
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