Skip to content
  • Daniel Vrátil's avatar
    Fix a crash due to weird refcount messup during stack unwinding · 7f104d75
    Daniel Vrátil authored
    Summary:
    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.
    
    Reviewers: #kde_pim, vkrause
    
    Reviewed By: #kde_pim, vkrause
    
    Subscribers: kde-pim
    
    Tags: #kde_pim
    
    Differential Revision: https://phabricator.kde.org/D21456
    7f104d75