My Akonadi Server has been crashing repeatadly whenever an exception was
thrown inside a handler. The crash was due to memory corruption when
stack unwinding caused the refcount of the "cmd" shared pointer to get
messed up which lead to double-free corruption.
The problem seems to be in the capture-by-value of the shared pointer in the
lambda, but I do not exactly understand what causes the problem, neither
was I able to produce a minimal reproducer case.
We can safely capture the shared pointer by reference, we don't keep a
reference to the functor anywhere.