From 2f38c83caf3227954c1536f2122eaa926e4ceb73 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Mon, 9 Dec 2024 19:49:57 -0700 Subject: [PATCH] LibGC: Mark GC::Function and create_function as ESCAPING Whenever we create a GC function, it should always be so that we can pass it to a platform event loop spin, HTML event loop spin, or some queued task on the HTML event loop. For every use case, any local variables will be out of scope by the time the function executes. --- Libraries/LibGC/Function.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibGC/Function.h b/Libraries/LibGC/Function.h index 047ea765cc5..9bc6dcf2518 100644 --- a/Libraries/LibGC/Function.h +++ b/Libraries/LibGC/Function.h @@ -17,7 +17,7 @@ class Function final : public Cell { GC_CELL(Function, Cell); public: - static Ref create(Heap& heap, AK::Function function) + static Ref create(Heap& heap, ESCAPING AK::Function function) { return heap.allocate(move(function)); } @@ -42,7 +42,7 @@ private: }; template> -static Ref> create_function(Heap& heap, Callable&& function) +static Ref> create_function(Heap& heap, ESCAPING Callable&& function) { return Function::create(heap, AK::Function { forward(function) }); }