From 8f81d9ad909c91dcc5f194b7befc483ab65a8a9a Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 4 Jun 2021 10:51:13 +0200 Subject: [PATCH] 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. --- AK/Function.h | 1 + 1 file changed, 1 insertion(+) diff --git a/AK/Function.h b/AK/Function.h index 85ee9de9b1..06e3f3a75d 100644 --- a/AK/Function.h +++ b/AK/Function.h @@ -205,6 +205,7 @@ private: template void init_with_callable(Callable&& callable) { + VERIFY(m_call_nesting_level == 0); using WrapperType = CallableWrapper; if constexpr (sizeof(WrapperType) > inline_capacity) { *bit_cast(&m_storage) = new WrapperType(move(callable));