AK: Verify that functions aren't modified while they're being invoked

A Function object should not be set to a different functor while the
original functor is currently executing.
This commit is contained in:
Gunnar Beutner 2021-06-04 10:51:13 +02:00 committed by Andreas Kling
parent 44418cb351
commit 8f81d9ad90
Notes: sideshowbarker 2024-07-18 16:53:34 +09:00

View file

@ -205,6 +205,7 @@ private:
template<typename Callable>
void init_with_callable(Callable&& callable)
{
VERIFY(m_call_nesting_level == 0);
using WrapperType = CallableWrapper<Callable>;
if constexpr (sizeof(WrapperType) > inline_capacity) {
*bit_cast<CallableWrapperBase**>(&m_storage) = new WrapperType(move(callable));