Browse Source

Userland: Add ESCAPING annotations to a bunch of places

This isn't comprehensive; just a result of a simple grep search.
Matthew Olsson 1 year ago
parent
commit
a98ad191c7
29 changed files with 60 additions and 59 deletions
  1. 1 1
      Tests/LibCore/TestLibCoreDeferredInvoke.cpp
  2. 1 1
      Tests/LibCore/TestLibCorePromise.cpp
  3. 3 3
      Tests/LibCore/TestLibCoreSharedSingleProducerCircularQueue.cpp
  4. 2 2
      Tests/LibThreading/TestThread.cpp
  5. 3 3
      Userland/Applications/ThemeEditor/main.cpp
  6. 3 3
      Userland/Libraries/LibCore/EventLoop.h
  7. 2 2
      Userland/Libraries/LibJS/Runtime/NativeFunction.h
  8. 2 2
      Userland/Libraries/LibJS/Runtime/Object.h
  9. 4 3
      Userland/Libraries/LibThreading/BackgroundAction.h
  10. 3 3
      Userland/Libraries/LibThreading/Thread.h
  11. 2 2
      Userland/Libraries/LibWeb/CSS/StyleComputer.h
  12. 1 1
      Userland/Libraries/LibWeb/DOM/AbortSignal.h
  13. 2 2
      Userland/Libraries/LibWeb/DOM/HTMLCollection.h
  14. 2 2
      Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h
  15. 2 2
      Userland/Libraries/LibWeb/DOM/LiveNodeList.h
  16. 2 2
      Userland/Libraries/LibWeb/DOM/RadioNodeList.h
  17. 2 2
      Userland/Libraries/LibWeb/HTML/HTMLAllCollection.h
  18. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h
  19. 2 2
      Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h
  20. 2 2
      Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
  21. 1 1
      Userland/Libraries/LibWeb/HTML/Window.cpp
  22. 1 1
      Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h
  23. 1 1
      Userland/Libraries/LibWeb/Loader/FileRequest.h
  24. 1 1
      Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h
  25. 1 1
      Userland/Libraries/LibWeb/Platform/ImageCodecPlugin.h
  26. 1 1
      Userland/Services/EchoServer/main.cpp
  27. 1 1
      Userland/Services/TelnetServer/main.cpp
  28. 1 1
      Userland/Services/WebContent/ImageCodecPluginSerenity.h
  29. 10 10
      Userland/Utilities/test-pthread.cpp

+ 1 - 1
Tests/LibCore/TestLibCoreDeferredInvoke.cpp

@@ -11,7 +11,7 @@
 
 TEST_CASE(deferred_invoke)
 {
-    Core::EventLoop event_loop;
+    IGNORE_USE_IN_ESCAPING_LAMBDA Core::EventLoop event_loop;
     auto reaper = Core::Timer::create_single_shot(250, [] {
         warnln("I waited for the deferred_invoke to happen, but it never did!");
         VERIFY_NOT_REACHED();

+ 1 - 1
Tests/LibCore/TestLibCorePromise.cpp

@@ -155,7 +155,7 @@ TEST_CASE(threaded_promise_resolved_later)
 {
     Core::EventLoop loop;
 
-    bool unblock_thread = false;
+    IGNORE_USE_IN_ESCAPING_LAMBDA bool unblock_thread = false;
     bool resolved = false;
     bool rejected = true;
     Optional<pthread_t> thread_id;

+ 3 - 3
Tests/LibCore/TestLibCoreSharedSingleProducerCircularQueue.cpp

@@ -43,7 +43,7 @@ TEST_CASE(simple_dequeue)
 // There is one parallel consumer, but nobody is producing at the same time.
 TEST_CASE(simple_multithread)
 {
-    auto queue = MUST(TestQueue::create());
+    IGNORE_USE_IN_ESCAPING_LAMBDA auto queue = MUST(TestQueue::create());
     auto const test_count = 10;
 
     for (int i = 0; i < test_count; ++i)
@@ -73,11 +73,11 @@ TEST_CASE(simple_multithread)
 // There is one parallel consumer and one parallel producer.
 TEST_CASE(producer_consumer_multithread)
 {
-    auto queue = MUST(TestQueue::create());
+    IGNORE_USE_IN_ESCAPING_LAMBDA auto queue = MUST(TestQueue::create());
     // Ensure that we have the possibility of filling the queue up.
     auto const test_count = queue.size() * 4;
 
-    Atomic<bool> other_thread_running { false };
+    IGNORE_USE_IN_ESCAPING_LAMBDA Atomic<bool> other_thread_running { false };
 
     auto second_thread = Threading::Thread::construct([&queue, &other_thread_running]() {
         auto copied_queue = queue;

+ 2 - 2
Tests/LibThreading/TestThread.cpp

@@ -27,7 +27,7 @@ static void sleep_until_thread_exits(Threading::Thread const& thread)
 
 TEST_CASE(threads_can_detach)
 {
-    Atomic<int> should_be_42 = 0;
+    IGNORE_USE_IN_ESCAPING_LAMBDA Atomic<int> should_be_42 = 0;
 
     auto thread = Threading::Thread::construct([&should_be_42]() {
         usleep(10 * 1000);
@@ -43,7 +43,7 @@ TEST_CASE(threads_can_detach)
 
 TEST_CASE(detached_threads_do_not_need_to_be_joined)
 {
-    Atomic<bool> should_exit { false };
+    IGNORE_USE_IN_ESCAPING_LAMBDA Atomic<bool> should_exit { false };
     auto thread = Threading::Thread::construct([&]() {
         while (!should_exit.load())
             usleep(10 * 1000);

+ 3 - 3
Userland/Applications/ThemeEditor/main.cpp

@@ -37,7 +37,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     parser.add_positional_argument(file_to_edit, "Theme file to edit", "file", Core::ArgsParser::Required::No);
     parser.parse(arguments);
 
-    Optional<ByteString> path = {};
+    IGNORE_USE_IN_ESCAPING_LAMBDA Optional<ByteString> path = {};
 
     if (auto error_or_path = FileSystem::absolute_path(file_to_edit); !file_to_edit.is_empty() && !error_or_path.is_error())
         path = error_or_path.release_value();
@@ -48,9 +48,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     TRY(Core::System::unveil(nullptr, nullptr));
 
     auto app_icon = GUI::Icon::default_icon("app-theme-editor"sv);
-    auto window = GUI::Window::construct();
+    IGNORE_USE_IN_ESCAPING_LAMBDA auto window = GUI::Window::construct();
 
-    auto main_widget = TRY(ThemeEditor::MainWidget::try_create());
+    IGNORE_USE_IN_ESCAPING_LAMBDA auto main_widget = TRY(ThemeEditor::MainWidget::try_create());
     window->set_main_widget(main_widget);
 
     if (path.has_value()) {

+ 3 - 3
Userland/Libraries/LibCore/EventLoop.h

@@ -67,7 +67,7 @@ public:
 
     void add_job(NonnullRefPtr<Promise<NonnullRefPtr<EventReceiver>>> job_promise);
 
-    void deferred_invoke(Function<void()>);
+    void deferred_invoke(ESCAPING Function<void()>);
 
     void wake();
 
@@ -82,7 +82,7 @@ public:
     static void register_notifier(Badge<Notifier>, Notifier&);
     static void unregister_notifier(Badge<Notifier>, Notifier&);
 
-    static int register_signal(int signo, Function<void(int)> handler);
+    static int register_signal(int signo, ESCAPING Function<void(int)> handler);
     static void unregister_signal(int handler_id);
 
     // Note: Boost uses Parent/Child/Prepare, but we don't really have anything
@@ -101,6 +101,6 @@ private:
     NonnullOwnPtr<EventLoopImplementation> m_impl;
 };
 
-void deferred_invoke(Function<void()>);
+void deferred_invoke(ESCAPING Function<void()>);
 
 }

+ 2 - 2
Userland/Libraries/LibJS/Runtime/NativeFunction.h

@@ -21,8 +21,8 @@ class NativeFunction : public FunctionObject {
     JS_DECLARE_ALLOCATOR(NativeFunction);
 
 public:
-    static NonnullGCPtr<NativeFunction> create(Realm&, Function<ThrowCompletionOr<Value>(VM&)> behaviour, i32 length, PropertyKey const& name, Optional<Realm*> = {}, Optional<Object*> prototype = {}, Optional<StringView> const& prefix = {});
-    static NonnullGCPtr<NativeFunction> create(Realm&, DeprecatedFlyString const& name, Function<ThrowCompletionOr<Value>(VM&)>);
+    static NonnullGCPtr<NativeFunction> create(Realm&, ESCAPING Function<ThrowCompletionOr<Value>(VM&)> behaviour, i32 length, PropertyKey const& name, Optional<Realm*> = {}, Optional<Object*> prototype = {}, Optional<StringView> const& prefix = {});
+    static NonnullGCPtr<NativeFunction> create(Realm&, DeprecatedFlyString const& name, ESCAPING Function<ThrowCompletionOr<Value>(VM&)>);
 
     virtual ~NativeFunction() override = default;
 

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Object.h

@@ -187,8 +187,8 @@ public:
     using IntrinsicAccessor = Value (*)(Realm&);
     void define_intrinsic_accessor(PropertyKey const&, PropertyAttributes attributes, IntrinsicAccessor accessor);
 
-    void define_native_function(Realm&, PropertyKey const&, Function<ThrowCompletionOr<Value>(VM&)>, i32 length, PropertyAttributes attributes, Optional<Bytecode::Builtin> builtin = {});
-    void define_native_accessor(Realm&, PropertyKey const&, Function<ThrowCompletionOr<Value>(VM&)> getter, Function<ThrowCompletionOr<Value>(VM&)> setter, PropertyAttributes attributes);
+    void define_native_function(Realm&, PropertyKey const&, ESCAPING Function<ThrowCompletionOr<Value>(VM&)>, i32 length, PropertyAttributes attributes, Optional<Bytecode::Builtin> builtin = {});
+    void define_native_accessor(Realm&, PropertyKey const&, ESCAPING Function<ThrowCompletionOr<Value>(VM&)> getter, ESCAPING Function<ThrowCompletionOr<Value>(VM&)> setter, PropertyAttributes attributes);
 
     virtual bool is_dom_node() const { return false; }
     virtual bool is_function() const { return false; }

+ 4 - 3
Userland/Libraries/LibThreading/BackgroundAction.h

@@ -30,12 +30,13 @@ class BackgroundActionBase {
 private:
     BackgroundActionBase() = default;
 
-    static void enqueue_work(Function<void()>);
+    static void enqueue_work(ESCAPING Function<void()>);
     static Thread& background_thread();
 };
 
 template<typename Result>
-class BackgroundAction final : public Core::EventReceiver
+class BackgroundAction final
+    : public Core::EventReceiver
     , private BackgroundActionBase {
     C_OBJECT(BackgroundAction);
 
@@ -54,7 +55,7 @@ public:
     bool is_canceled() const { return m_canceled; }
 
 private:
-    BackgroundAction(Function<ErrorOr<Result>(BackgroundAction&)> action, Function<ErrorOr<void>(Result)> on_complete, Optional<Function<void(Error)>> on_error = {})
+    BackgroundAction(ESCAPING Function<ErrorOr<Result>(BackgroundAction&)> action, ESCAPING Function<ErrorOr<void>(Result)> on_complete, ESCAPING Optional<Function<void(Error)>> on_error = {})
         : m_promise(Promise::try_create().release_value_but_fixme_should_propagate_errors())
         , m_action(move(action))
         , m_on_complete(move(on_complete))

+ 3 - 3
Userland/Libraries/LibThreading/Thread.h

@@ -46,11 +46,11 @@ class Thread final
     : public AtomicRefCounted<Thread>
     , public Weakable<Thread> {
 public:
-    static NonnullRefPtr<Thread> construct(Function<intptr_t()> action, StringView thread_name = {})
+    static NonnullRefPtr<Thread> construct(ESCAPING Function<intptr_t()> action, StringView thread_name = {})
     {
         return adopt_ref(*new Thread(move(action), thread_name));
     }
-    static ErrorOr<NonnullRefPtr<Thread>> try_create(Function<intptr_t()> action, StringView thread_name = {})
+    static ErrorOr<NonnullRefPtr<Thread>> try_create(ESCAPING Function<intptr_t()> action, StringView thread_name = {})
     {
         return adopt_nonnull_ref_or_enomem(new (nothrow) Thread(move(action), thread_name));
     }
@@ -77,7 +77,7 @@ public:
     bool has_exited() const;
 
 private:
-    explicit Thread(Function<intptr_t()> action, StringView thread_name = {});
+    explicit Thread(ESCAPING Function<intptr_t()> action, StringView thread_name = {});
     Function<intptr_t()> m_action;
     pthread_t m_tid { 0 };
     ByteString m_thread_name;

+ 2 - 2
Userland/Libraries/LibWeb/CSS/StyleComputer.h

@@ -138,7 +138,7 @@ public:
 
     void did_load_font(FlyString const& family_name);
 
-    Optional<FontLoader&> load_font_face(ParsedFontFace const&, Function<void(FontLoader const&)> on_load = {}, Function<void()> on_fail = {});
+    Optional<FontLoader&> load_font_face(ParsedFontFace const&, ESCAPING Function<void(FontLoader const&)> on_load = {}, ESCAPING Function<void()> on_fail = {});
 
     void load_fonts_from_sheet(CSSStyleSheet const&);
 
@@ -232,7 +232,7 @@ private:
 
 class FontLoader : public ResourceClient {
 public:
-    FontLoader(StyleComputer& style_computer, FlyString family_name, Vector<Gfx::UnicodeRange> unicode_ranges, Vector<URL::URL> urls, Function<void(FontLoader const&)> on_load = {}, Function<void()> on_fail = {});
+    FontLoader(StyleComputer& style_computer, FlyString family_name, Vector<Gfx::UnicodeRange> unicode_ranges, Vector<URL::URL> urls, ESCAPING Function<void(FontLoader const&)> on_load = {}, ESCAPING Function<void()> on_fail = {});
 
     virtual ~FontLoader() override;
 

+ 1 - 1
Userland/Libraries/LibWeb/DOM/AbortSignal.h

@@ -26,7 +26,7 @@ public:
 
     virtual ~AbortSignal() override = default;
 
-    void add_abort_algorithm(Function<void()>);
+    void add_abort_algorithm(ESCAPING Function<void()>);
 
     // https://dom.spec.whatwg.org/#dom-abortsignal-aborted
     // An AbortSignal object is aborted when its abort reason is not undefined.

+ 2 - 2
Userland/Libraries/LibWeb/DOM/HTMLCollection.h

@@ -30,7 +30,7 @@ public:
         Children,
         Descendants,
     };
-    [[nodiscard]] static JS::NonnullGCPtr<HTMLCollection> create(ParentNode& root, Scope, Function<bool(Element const&)> filter);
+    [[nodiscard]] static JS::NonnullGCPtr<HTMLCollection> create(ParentNode& root, Scope, ESCAPING Function<bool(Element const&)> filter);
 
     virtual ~HTMLCollection() override;
 
@@ -46,7 +46,7 @@ public:
     virtual bool is_supported_property_index(u32) const override;
 
 protected:
-    HTMLCollection(ParentNode& root, Scope, Function<bool(Element const&)> filter);
+    HTMLCollection(ParentNode& root, Scope, ESCAPING Function<bool(Element const&)> filter);
 
     virtual void initialize(JS::Realm&) override;
 

+ 2 - 2
Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h

@@ -16,7 +16,7 @@ class HTMLFormControlsCollection : public HTMLCollection {
     JS_DECLARE_ALLOCATOR(HTMLFormControlsCollection);
 
 public:
-    [[nodiscard]] static JS::NonnullGCPtr<HTMLFormControlsCollection> create(ParentNode& root, Scope, Function<bool(Element const&)> filter);
+    [[nodiscard]] static JS::NonnullGCPtr<HTMLFormControlsCollection> create(ParentNode& root, Scope, ESCAPING Function<bool(Element const&)> filter);
 
     virtual ~HTMLFormControlsCollection() override;
 
@@ -28,7 +28,7 @@ protected:
     virtual WebIDL::ExceptionOr<JS::Value> named_item_value(FlyString const& name) const final;
 
 private:
-    HTMLFormControlsCollection(ParentNode& root, Scope, Function<bool(Element const&)> filter);
+    HTMLFormControlsCollection(ParentNode& root, Scope, ESCAPING Function<bool(Element const&)> filter);
 };
 
 }

+ 2 - 2
Userland/Libraries/LibWeb/DOM/LiveNodeList.h

@@ -24,7 +24,7 @@ public:
         Descendants,
     };
 
-    [[nodiscard]] static JS::NonnullGCPtr<NodeList> create(JS::Realm&, Node const& root, Scope, Function<bool(Node const&)> filter);
+    [[nodiscard]] static JS::NonnullGCPtr<NodeList> create(JS::Realm&, Node const& root, Scope, ESCAPING Function<bool(Node const&)> filter);
     virtual ~LiveNodeList() override;
 
     virtual u32 length() const override;
@@ -33,7 +33,7 @@ public:
     virtual bool is_supported_property_index(u32) const override;
 
 protected:
-    LiveNodeList(JS::Realm&, Node const& root, Scope, Function<bool(Node const&)> filter);
+    LiveNodeList(JS::Realm&, Node const& root, Scope, ESCAPING Function<bool(Node const&)> filter);
 
     Node* first_matching(Function<bool(Node const&)> const& filter) const;
 

+ 2 - 2
Userland/Libraries/LibWeb/DOM/RadioNodeList.h

@@ -16,7 +16,7 @@ class RadioNodeList : public LiveNodeList {
     JS_DECLARE_ALLOCATOR(RadioNodeList);
 
 public:
-    [[nodiscard]] static JS::NonnullGCPtr<RadioNodeList> create(JS::Realm& realm, Node const& root, Scope scope, Function<bool(Node const&)> filter);
+    [[nodiscard]] static JS::NonnullGCPtr<RadioNodeList> create(JS::Realm& realm, Node const& root, Scope scope, ESCAPING Function<bool(Node const&)> filter);
 
     virtual ~RadioNodeList() override;
 
@@ -27,7 +27,7 @@ protected:
     virtual void initialize(JS::Realm&) override;
 
 private:
-    explicit RadioNodeList(JS::Realm& realm, Node const& root, Scope scope, Function<bool(Node const&)> filter);
+    explicit RadioNodeList(JS::Realm& realm, Node const& root, Scope scope, ESCAPING Function<bool(Node const&)> filter);
 };
 
 }

+ 2 - 2
Userland/Libraries/LibWeb/HTML/HTMLAllCollection.h

@@ -24,7 +24,7 @@ public:
         Children,
         Descendants,
     };
-    [[nodiscard]] static JS::NonnullGCPtr<HTMLAllCollection> create(DOM::ParentNode& root, Scope, Function<bool(DOM::Element const&)> filter);
+    [[nodiscard]] static JS::NonnullGCPtr<HTMLAllCollection> create(DOM::ParentNode& root, Scope, ESCAPING Function<bool(DOM::Element const&)> filter);
 
     virtual ~HTMLAllCollection() override;
 
@@ -40,7 +40,7 @@ public:
     virtual bool is_supported_property_index(u32) const override;
 
 protected:
-    HTMLAllCollection(DOM::ParentNode& root, Scope, Function<bool(DOM::Element const&)> filter);
+    HTMLAllCollection(DOM::ParentNode& root, Scope, ESCAPING Function<bool(DOM::Element const&)> filter);
 
     virtual void initialize(JS::Realm&) override;
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h

@@ -162,7 +162,7 @@ private:
     Task::Source media_element_event_task_source() const { return m_media_element_event_task_source.source; }
 
     WebIDL::ExceptionOr<void> load_element();
-    WebIDL::ExceptionOr<void> fetch_resource(URL::URL const&, Function<void(String)> failure_callback);
+    WebIDL::ExceptionOr<void> fetch_resource(URL::URL const&, ESCAPING Function<void(String)> failure_callback);
     static bool verify_response(JS::NonnullGCPtr<Fetch::Infrastructure::Response>, ByteRange const&);
     WebIDL::ExceptionOr<void> process_media_data(Function<void(String)> failure_callback);
     WebIDL::ExceptionOr<void> handle_media_source_failure(Span<JS::NonnullGCPtr<WebIDL::Promise>> promises, String error_message);

+ 2 - 2
Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h

@@ -21,7 +21,7 @@ class HTMLOptionsCollection final : public DOM::HTMLCollection {
     JS_DECLARE_ALLOCATOR(HTMLOptionsCollection);
 
 public:
-    [[nodiscard]] static JS::NonnullGCPtr<HTMLOptionsCollection> create(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter);
+    [[nodiscard]] static JS::NonnullGCPtr<HTMLOptionsCollection> create(DOM::ParentNode& root, ESCAPING Function<bool(DOM::Element const&)> filter);
     virtual ~HTMLOptionsCollection() override;
 
     WebIDL::ExceptionOr<void> set_length(WebIDL::UnsignedLong);
@@ -34,7 +34,7 @@ public:
     void set_selected_index(WebIDL::Long);
 
 private:
-    HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter);
+    HTMLOptionsCollection(DOM::ParentNode& root, ESCAPING Function<bool(DOM::Element const&)> filter);
 
     virtual void initialize(JS::Realm&) override;
 };

+ 2 - 2
Userland/Libraries/LibWeb/HTML/TraversableNavigable.h

@@ -69,12 +69,12 @@ public:
     void close_top_level_traversable();
     void destroy_top_level_traversable();
 
-    void append_session_history_traversal_steps(Function<void()> steps)
+    void append_session_history_traversal_steps(ESCAPING Function<void()> steps)
     {
         m_session_history_traversal_queue->append(move(steps));
     }
 
-    void append_session_history_synchronous_navigation_steps(JS::NonnullGCPtr<Navigable> target_navigable, Function<void()> steps)
+    void append_session_history_synchronous_navigation_steps(JS::NonnullGCPtr<Navigable> target_navigable, ESCAPING Function<void()> steps)
     {
         m_session_history_traversal_queue->append_sync(move(steps), target_navigable);
     }

+ 1 - 1
Userland/Libraries/LibWeb/HTML/Window.cpp

@@ -83,7 +83,7 @@ void run_animation_frame_callbacks(DOM::Document& document, double now)
 
 class IdleCallback : public RefCounted<IdleCallback> {
 public:
-    explicit IdleCallback(Function<JS::Completion(JS::NonnullGCPtr<RequestIdleCallback::IdleDeadline>)> handler, u32 handle)
+    explicit IdleCallback(ESCAPING Function<JS::Completion(JS::NonnullGCPtr<RequestIdleCallback::IdleDeadline>)> handler, u32 handle)
         : m_handler(move(handler))
         , m_handle(handle)
     {

+ 1 - 1
Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h

@@ -135,7 +135,7 @@ private:
             current_collapsible_margins.append(margin);
         }
 
-        void register_block_container_y_position_update_callback(Function<void(CSSPixels)> callback)
+        void register_block_container_y_position_update_callback(ESCAPING Function<void(CSSPixels)> callback)
         {
             block_container_y_position_update_callback = move(callback);
         }

+ 1 - 1
Userland/Libraries/LibWeb/Loader/FileRequest.h

@@ -14,7 +14,7 @@ namespace Web {
 
 class FileRequest {
 public:
-    FileRequest(ByteString path, Function<void(ErrorOr<i32>)> on_file_request_finish);
+    FileRequest(ByteString path, ESCAPING Function<void(ErrorOr<i32>)> on_file_request_finish);
 
     ByteString path() const;
 

+ 1 - 1
Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h

@@ -20,7 +20,7 @@ public:
     virtual ~EventLoopPlugin();
 
     virtual void spin_until(JS::SafeFunction<bool()> goal_condition) = 0;
-    virtual void deferred_invoke(JS::SafeFunction<void()>) = 0;
+    virtual void deferred_invoke(ESCAPING JS::SafeFunction<void()>) = 0;
     virtual NonnullRefPtr<Timer> create_timer() = 0;
     virtual void quit() = 0;
 };

+ 1 - 1
Userland/Libraries/LibWeb/Platform/ImageCodecPlugin.h

@@ -32,7 +32,7 @@ public:
 
     virtual ~ImageCodecPlugin();
 
-    virtual NonnullRefPtr<Core::Promise<DecodedImage>> decode_image(ReadonlyBytes, Function<ErrorOr<void>(DecodedImage&)> on_resolved, Function<void(Error&)> on_rejected) = 0;
+    virtual NonnullRefPtr<Core::Promise<DecodedImage>> decode_image(ReadonlyBytes, ESCAPING Function<ErrorOr<void>(DecodedImage&)> on_resolved, ESCAPING Function<void(Error&)> on_rejected) = 0;
 };
 
 }

+ 1 - 1
Userland/Services/EchoServer/main.cpp

@@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     auto server = TRY(Core::TCPServer::try_create());
     TRY(server->listen({}, port));
 
-    HashMap<int, NonnullRefPtr<Client>> clients;
+    IGNORE_USE_IN_ESCAPING_LAMBDA HashMap<int, NonnullRefPtr<Client>> clients;
     int next_id = 0;
 
     server->on_ready_to_accept = [&next_id, &clients, &server] {

+ 1 - 1
Userland/Services/TelnetServer/main.cpp

@@ -102,7 +102,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     auto server = TRY(Core::TCPServer::try_create());
     TRY(server->listen({}, port));
 
-    HashMap<int, NonnullRefPtr<Client>> clients;
+    IGNORE_USE_IN_ESCAPING_LAMBDA HashMap<int, NonnullRefPtr<Client>> clients;
     int next_id = 0;
 
     server->on_ready_to_accept = [&next_id, &clients, &server, command] {

+ 1 - 1
Userland/Services/WebContent/ImageCodecPluginSerenity.h

@@ -21,7 +21,7 @@ public:
     ImageCodecPluginSerenity();
     virtual ~ImageCodecPluginSerenity() override;
 
-    virtual NonnullRefPtr<Core::Promise<Web::Platform::DecodedImage>> decode_image(ReadonlyBytes, Function<ErrorOr<void>(Web::Platform::DecodedImage&)> on_resolved, Function<void(Error&)> on_rejected) override;
+    virtual NonnullRefPtr<Core::Promise<Web::Platform::DecodedImage>> decode_image(ReadonlyBytes, ESCAPING Function<ErrorOr<void>(Web::Platform::DecodedImage&)> on_resolved, ESCAPING Function<void(Error&)> on_rejected) override;
 
 private:
     RefPtr<ImageDecoderClient::Client> m_client;

+ 10 - 10
Userland/Utilities/test-pthread.cpp

@@ -18,7 +18,7 @@ static ErrorOr<void> test_once()
 
     static Vector<int> v;
     v.clear();
-    pthread_once_t once = PTHREAD_ONCE_INIT;
+    IGNORE_USE_IN_ESCAPING_LAMBDA pthread_once_t once = PTHREAD_ONCE_INIT;
     Vector<NonnullRefPtr<Threading::Thread>, threads_count> threads;
 
     for (size_t i = 0; i < threads_count; i++) {
@@ -44,9 +44,9 @@ static ErrorOr<void> test_mutex()
     constexpr size_t threads_count = 10;
     constexpr size_t num_times = 100;
 
-    Vector<int> v;
+    IGNORE_USE_IN_ESCAPING_LAMBDA Vector<int> v;
     Vector<NonnullRefPtr<Threading::Thread>, threads_count> threads;
-    pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+    IGNORE_USE_IN_ESCAPING_LAMBDA pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 
     for (size_t i = 0; i < threads_count; i++) {
         threads.unchecked_append(TRY(Threading::Thread::try_create([&] {
@@ -77,9 +77,9 @@ static ErrorOr<void> test_semaphore_as_lock()
     constexpr size_t threads_count = 10;
     constexpr size_t num_times = 100;
 
-    Vector<int> v;
+    IGNORE_USE_IN_ESCAPING_LAMBDA Vector<int> v;
     Vector<NonnullRefPtr<Threading::Thread>, threads_count> threads;
-    sem_t semaphore;
+    IGNORE_USE_IN_ESCAPING_LAMBDA sem_t semaphore;
     sem_init(&semaphore, 0, 1);
 
     for (size_t i = 0; i < threads_count; i++) {
@@ -109,8 +109,8 @@ static ErrorOr<void> test_semaphore_as_lock()
 
 static ErrorOr<void> test_semaphore_as_event()
 {
-    Vector<int> v;
-    sem_t semaphore;
+    IGNORE_USE_IN_ESCAPING_LAMBDA Vector<int> v;
+    IGNORE_USE_IN_ESCAPING_LAMBDA sem_t semaphore;
     sem_init(&semaphore, 0, 0);
 
     auto reader = TRY(Threading::Thread::try_create([&] {
@@ -144,11 +144,11 @@ static ErrorOr<void> test_semaphore_nonbinary()
     constexpr size_t num_times = 100;
 
     Vector<NonnullRefPtr<Threading::Thread>, threads_count> threads;
-    sem_t semaphore;
+    IGNORE_USE_IN_ESCAPING_LAMBDA sem_t semaphore;
     sem_init(&semaphore, 0, num);
 
-    Atomic<u32, AK::memory_order_relaxed> value = 0;
-    Atomic<bool, AK::memory_order_relaxed> seen_more_than_two = false;
+    IGNORE_USE_IN_ESCAPING_LAMBDA Atomic<u32, AK::memory_order_relaxed> value = 0;
+    IGNORE_USE_IN_ESCAPING_LAMBDA Atomic<bool, AK::memory_order_relaxed> seen_more_than_two = false;
 
     for (size_t i = 0; i < threads_count; i++) {
         threads.unchecked_append(TRY(Threading::Thread::try_create([&] {