mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:27:45 +00:00
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:
parent
44418cb351
commit
8f81d9ad90
1 changed files with 1 additions and 0 deletions
|
@ -205,6 +205,7 @@ private:
|
||||||
template<typename Callable>
|
template<typename Callable>
|
||||||
void init_with_callable(Callable&& callable)
|
void init_with_callable(Callable&& callable)
|
||||||
{
|
{
|
||||||
|
VERIFY(m_call_nesting_level == 0);
|
||||||
using WrapperType = CallableWrapper<Callable>;
|
using WrapperType = CallableWrapper<Callable>;
|
||||||
if constexpr (sizeof(WrapperType) > inline_capacity) {
|
if constexpr (sizeof(WrapperType) > inline_capacity) {
|
||||||
*bit_cast<CallableWrapperBase**>(&m_storage) = new WrapperType(move(callable));
|
*bit_cast<CallableWrapperBase**>(&m_storage) = new WrapperType(move(callable));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue