mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +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
Notes:
sideshowbarker
2024-07-18 16:53:34 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/8f81d9ad909 Pull-request: https://github.com/SerenityOS/serenity/pull/7774
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…
Reference in a new issue