From a98ad191c715a5fd310f59b248c673984f88962e Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Fri, 17 May 2024 17:14:06 -0700 Subject: [PATCH] Userland: Add ESCAPING annotations to a bunch of places This isn't comprehensive; just a result of a simple grep search. --- Tests/LibCore/TestLibCoreDeferredInvoke.cpp | 2 +- Tests/LibCore/TestLibCorePromise.cpp | 2 +- ...bCoreSharedSingleProducerCircularQueue.cpp | 6 +++--- Tests/LibThreading/TestThread.cpp | 4 ++-- Userland/Applications/ThemeEditor/main.cpp | 6 +++--- Userland/Libraries/LibCore/EventLoop.h | 6 +++--- .../Libraries/LibJS/Runtime/NativeFunction.h | 4 ++-- Userland/Libraries/LibJS/Runtime/Object.h | 4 ++-- .../Libraries/LibThreading/BackgroundAction.h | 7 ++++--- Userland/Libraries/LibThreading/Thread.h | 6 +++--- Userland/Libraries/LibWeb/CSS/StyleComputer.h | 4 ++-- Userland/Libraries/LibWeb/DOM/AbortSignal.h | 2 +- .../Libraries/LibWeb/DOM/HTMLCollection.h | 4 ++-- .../LibWeb/DOM/HTMLFormControlsCollection.h | 4 ++-- Userland/Libraries/LibWeb/DOM/LiveNodeList.h | 4 ++-- Userland/Libraries/LibWeb/DOM/RadioNodeList.h | 4 ++-- .../Libraries/LibWeb/HTML/HTMLAllCollection.h | 4 ++-- .../Libraries/LibWeb/HTML/HTMLMediaElement.h | 2 +- .../LibWeb/HTML/HTMLOptionsCollection.h | 4 ++-- .../LibWeb/HTML/TraversableNavigable.h | 4 ++-- Userland/Libraries/LibWeb/HTML/Window.cpp | 2 +- .../LibWeb/Layout/BlockFormattingContext.h | 2 +- .../Libraries/LibWeb/Loader/FileRequest.h | 2 +- .../LibWeb/Platform/EventLoopPlugin.h | 2 +- .../LibWeb/Platform/ImageCodecPlugin.h | 2 +- Userland/Services/EchoServer/main.cpp | 2 +- Userland/Services/TelnetServer/main.cpp | 2 +- .../WebContent/ImageCodecPluginSerenity.h | 2 +- Userland/Utilities/test-pthread.cpp | 20 +++++++++---------- 29 files changed, 60 insertions(+), 59 deletions(-) diff --git a/Tests/LibCore/TestLibCoreDeferredInvoke.cpp b/Tests/LibCore/TestLibCoreDeferredInvoke.cpp index 097d22ab5e4..7e6e9001ed1 100644 --- a/Tests/LibCore/TestLibCoreDeferredInvoke.cpp +++ b/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(); diff --git a/Tests/LibCore/TestLibCorePromise.cpp b/Tests/LibCore/TestLibCorePromise.cpp index 286e6c50414..3f8e2599601 100644 --- a/Tests/LibCore/TestLibCorePromise.cpp +++ b/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 thread_id; diff --git a/Tests/LibCore/TestLibCoreSharedSingleProducerCircularQueue.cpp b/Tests/LibCore/TestLibCoreSharedSingleProducerCircularQueue.cpp index b30be886c90..49139cb957a 100644 --- a/Tests/LibCore/TestLibCoreSharedSingleProducerCircularQueue.cpp +++ b/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 other_thread_running { false }; + IGNORE_USE_IN_ESCAPING_LAMBDA Atomic other_thread_running { false }; auto second_thread = Threading::Thread::construct([&queue, &other_thread_running]() { auto copied_queue = queue; diff --git a/Tests/LibThreading/TestThread.cpp b/Tests/LibThreading/TestThread.cpp index c5a483c42b8..38396056a38 100644 --- a/Tests/LibThreading/TestThread.cpp +++ b/Tests/LibThreading/TestThread.cpp @@ -27,7 +27,7 @@ static void sleep_until_thread_exits(Threading::Thread const& thread) TEST_CASE(threads_can_detach) { - Atomic should_be_42 = 0; + IGNORE_USE_IN_ESCAPING_LAMBDA Atomic 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 should_exit { false }; + IGNORE_USE_IN_ESCAPING_LAMBDA Atomic should_exit { false }; auto thread = Threading::Thread::construct([&]() { while (!should_exit.load()) usleep(10 * 1000); diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index d4a228802e2..70afa4e33b8 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -37,7 +37,7 @@ ErrorOr 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 path = {}; + IGNORE_USE_IN_ESCAPING_LAMBDA Optional 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 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()) { diff --git a/Userland/Libraries/LibCore/EventLoop.h b/Userland/Libraries/LibCore/EventLoop.h index bdca1565200..61cbfafcf9e 100644 --- a/Userland/Libraries/LibCore/EventLoop.h +++ b/Userland/Libraries/LibCore/EventLoop.h @@ -67,7 +67,7 @@ public: void add_job(NonnullRefPtr>> job_promise); - void deferred_invoke(Function); + void deferred_invoke(ESCAPING Function); void wake(); @@ -82,7 +82,7 @@ public: static void register_notifier(Badge, Notifier&); static void unregister_notifier(Badge, Notifier&); - static int register_signal(int signo, Function handler); + static int register_signal(int signo, ESCAPING Function 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 m_impl; }; -void deferred_invoke(Function); +void deferred_invoke(ESCAPING Function); } diff --git a/Userland/Libraries/LibJS/Runtime/NativeFunction.h b/Userland/Libraries/LibJS/Runtime/NativeFunction.h index 338dc272dce..afa4f8063d5 100644 --- a/Userland/Libraries/LibJS/Runtime/NativeFunction.h +++ b/Userland/Libraries/LibJS/Runtime/NativeFunction.h @@ -21,8 +21,8 @@ class NativeFunction : public FunctionObject { JS_DECLARE_ALLOCATOR(NativeFunction); public: - static NonnullGCPtr create(Realm&, Function(VM&)> behaviour, i32 length, PropertyKey const& name, Optional = {}, Optional prototype = {}, Optional const& prefix = {}); - static NonnullGCPtr create(Realm&, DeprecatedFlyString const& name, Function(VM&)>); + static NonnullGCPtr create(Realm&, ESCAPING Function(VM&)> behaviour, i32 length, PropertyKey const& name, Optional = {}, Optional prototype = {}, Optional const& prefix = {}); + static NonnullGCPtr create(Realm&, DeprecatedFlyString const& name, ESCAPING Function(VM&)>); virtual ~NativeFunction() override = default; diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index 86a2818a7fb..138edb0e5e5 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/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(VM&)>, i32 length, PropertyAttributes attributes, Optional builtin = {}); - void define_native_accessor(Realm&, PropertyKey const&, Function(VM&)> getter, Function(VM&)> setter, PropertyAttributes attributes); + void define_native_function(Realm&, PropertyKey const&, ESCAPING Function(VM&)>, i32 length, PropertyAttributes attributes, Optional builtin = {}); + void define_native_accessor(Realm&, PropertyKey const&, ESCAPING Function(VM&)> getter, ESCAPING Function(VM&)> setter, PropertyAttributes attributes); virtual bool is_dom_node() const { return false; } virtual bool is_function() const { return false; } diff --git a/Userland/Libraries/LibThreading/BackgroundAction.h b/Userland/Libraries/LibThreading/BackgroundAction.h index 97b1c2fccf4..7d25b2f4a9f 100644 --- a/Userland/Libraries/LibThreading/BackgroundAction.h +++ b/Userland/Libraries/LibThreading/BackgroundAction.h @@ -30,12 +30,13 @@ class BackgroundActionBase { private: BackgroundActionBase() = default; - static void enqueue_work(Function); + static void enqueue_work(ESCAPING Function); static Thread& background_thread(); }; template -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(BackgroundAction&)> action, Function(Result)> on_complete, Optional> on_error = {}) + BackgroundAction(ESCAPING Function(BackgroundAction&)> action, ESCAPING Function(Result)> on_complete, ESCAPING Optional> on_error = {}) : m_promise(Promise::try_create().release_value_but_fixme_should_propagate_errors()) , m_action(move(action)) , m_on_complete(move(on_complete)) diff --git a/Userland/Libraries/LibThreading/Thread.h b/Userland/Libraries/LibThreading/Thread.h index 87a649ab6ab..10fce0c8103 100644 --- a/Userland/Libraries/LibThreading/Thread.h +++ b/Userland/Libraries/LibThreading/Thread.h @@ -46,11 +46,11 @@ class Thread final : public AtomicRefCounted , public Weakable { public: - static NonnullRefPtr construct(Function action, StringView thread_name = {}) + static NonnullRefPtr construct(ESCAPING Function action, StringView thread_name = {}) { return adopt_ref(*new Thread(move(action), thread_name)); } - static ErrorOr> try_create(Function action, StringView thread_name = {}) + static ErrorOr> try_create(ESCAPING Function 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 action, StringView thread_name = {}); + explicit Thread(ESCAPING Function action, StringView thread_name = {}); Function m_action; pthread_t m_tid { 0 }; ByteString m_thread_name; diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.h b/Userland/Libraries/LibWeb/CSS/StyleComputer.h index 359308fa610..f34a597656a 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.h +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.h @@ -138,7 +138,7 @@ public: void did_load_font(FlyString const& family_name); - Optional load_font_face(ParsedFontFace const&, Function on_load = {}, Function on_fail = {}); + Optional load_font_face(ParsedFontFace const&, ESCAPING Function on_load = {}, ESCAPING Function 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 unicode_ranges, Vector urls, Function on_load = {}, Function on_fail = {}); + FontLoader(StyleComputer& style_computer, FlyString family_name, Vector unicode_ranges, Vector urls, ESCAPING Function on_load = {}, ESCAPING Function on_fail = {}); virtual ~FontLoader() override; diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.h b/Userland/Libraries/LibWeb/DOM/AbortSignal.h index 125f482952b..1c60eef1ed2 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortSignal.h +++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.h @@ -26,7 +26,7 @@ public: virtual ~AbortSignal() override = default; - void add_abort_algorithm(Function); + void add_abort_algorithm(ESCAPING Function); // https://dom.spec.whatwg.org/#dom-abortsignal-aborted // An AbortSignal object is aborted when its abort reason is not undefined. diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.h b/Userland/Libraries/LibWeb/DOM/HTMLCollection.h index aab5f24918c..844323a200e 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.h +++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.h @@ -30,7 +30,7 @@ public: Children, Descendants, }; - [[nodiscard]] static JS::NonnullGCPtr create(ParentNode& root, Scope, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(ParentNode& root, Scope, ESCAPING Function filter); virtual ~HTMLCollection() override; @@ -46,7 +46,7 @@ public: virtual bool is_supported_property_index(u32) const override; protected: - HTMLCollection(ParentNode& root, Scope, Function filter); + HTMLCollection(ParentNode& root, Scope, ESCAPING Function filter); virtual void initialize(JS::Realm&) override; diff --git a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h index e20ee229c01..809bbff4238 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h +++ b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h @@ -16,7 +16,7 @@ class HTMLFormControlsCollection : public HTMLCollection { JS_DECLARE_ALLOCATOR(HTMLFormControlsCollection); public: - [[nodiscard]] static JS::NonnullGCPtr create(ParentNode& root, Scope, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(ParentNode& root, Scope, ESCAPING Function filter); virtual ~HTMLFormControlsCollection() override; @@ -28,7 +28,7 @@ protected: virtual WebIDL::ExceptionOr named_item_value(FlyString const& name) const final; private: - HTMLFormControlsCollection(ParentNode& root, Scope, Function filter); + HTMLFormControlsCollection(ParentNode& root, Scope, ESCAPING Function filter); }; } diff --git a/Userland/Libraries/LibWeb/DOM/LiveNodeList.h b/Userland/Libraries/LibWeb/DOM/LiveNodeList.h index 4084c16a5eb..aa40045ff1c 100644 --- a/Userland/Libraries/LibWeb/DOM/LiveNodeList.h +++ b/Userland/Libraries/LibWeb/DOM/LiveNodeList.h @@ -24,7 +24,7 @@ public: Descendants, }; - [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, Node const& root, Scope, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, Node const& root, Scope, ESCAPING Function 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 filter); + LiveNodeList(JS::Realm&, Node const& root, Scope, ESCAPING Function filter); Node* first_matching(Function const& filter) const; diff --git a/Userland/Libraries/LibWeb/DOM/RadioNodeList.h b/Userland/Libraries/LibWeb/DOM/RadioNodeList.h index ab7ecf548b4..0e5c52909e0 100644 --- a/Userland/Libraries/LibWeb/DOM/RadioNodeList.h +++ b/Userland/Libraries/LibWeb/DOM/RadioNodeList.h @@ -16,7 +16,7 @@ class RadioNodeList : public LiveNodeList { JS_DECLARE_ALLOCATOR(RadioNodeList); public: - [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm& realm, Node const& root, Scope scope, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm& realm, Node const& root, Scope scope, ESCAPING Function 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 filter); + explicit RadioNodeList(JS::Realm& realm, Node const& root, Scope scope, ESCAPING Function filter); }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAllCollection.h b/Userland/Libraries/LibWeb/HTML/HTMLAllCollection.h index b5dc52d7e92..e866863f6f4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAllCollection.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAllCollection.h @@ -24,7 +24,7 @@ public: Children, Descendants, }; - [[nodiscard]] static JS::NonnullGCPtr create(DOM::ParentNode& root, Scope, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(DOM::ParentNode& root, Scope, ESCAPING Function 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 filter); + HTMLAllCollection(DOM::ParentNode& root, Scope, ESCAPING Function filter); virtual void initialize(JS::Realm&) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h index dfd1539fbc4..858af8d3dcf 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h +++ b/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 load_element(); - WebIDL::ExceptionOr fetch_resource(URL::URL const&, Function failure_callback); + WebIDL::ExceptionOr fetch_resource(URL::URL const&, ESCAPING Function failure_callback); static bool verify_response(JS::NonnullGCPtr, ByteRange const&); WebIDL::ExceptionOr process_media_data(Function failure_callback); WebIDL::ExceptionOr handle_media_source_failure(Span> promises, String error_message); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h index abb8b46435e..68b97dde8e4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h +++ b/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 create(DOM::ParentNode& root, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(DOM::ParentNode& root, ESCAPING Function filter); virtual ~HTMLOptionsCollection() override; WebIDL::ExceptionOr set_length(WebIDL::UnsignedLong); @@ -34,7 +34,7 @@ public: void set_selected_index(WebIDL::Long); private: - HTMLOptionsCollection(DOM::ParentNode& root, Function filter); + HTMLOptionsCollection(DOM::ParentNode& root, ESCAPING Function filter); virtual void initialize(JS::Realm&) override; }; diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h index f27513dd777..e254026aa29 100644 --- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h +++ b/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 steps) + void append_session_history_traversal_steps(ESCAPING Function steps) { m_session_history_traversal_queue->append(move(steps)); } - void append_session_history_synchronous_navigation_steps(JS::NonnullGCPtr target_navigable, Function steps) + void append_session_history_synchronous_navigation_steps(JS::NonnullGCPtr target_navigable, ESCAPING Function steps) { m_session_history_traversal_queue->append_sync(move(steps), target_navigable); } diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 2461ce01051..7850264d83d 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -83,7 +83,7 @@ void run_animation_frame_callbacks(DOM::Document& document, double now) class IdleCallback : public RefCounted { public: - explicit IdleCallback(Function)> handler, u32 handle) + explicit IdleCallback(ESCAPING Function)> handler, u32 handle) : m_handler(move(handler)) , m_handle(handle) { diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h index 08045edde6d..99b979ca32e 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h +++ b/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 callback) + void register_block_container_y_position_update_callback(ESCAPING Function callback) { block_container_y_position_update_callback = move(callback); } diff --git a/Userland/Libraries/LibWeb/Loader/FileRequest.h b/Userland/Libraries/LibWeb/Loader/FileRequest.h index f898228ff77..05f862dafb7 100644 --- a/Userland/Libraries/LibWeb/Loader/FileRequest.h +++ b/Userland/Libraries/LibWeb/Loader/FileRequest.h @@ -14,7 +14,7 @@ namespace Web { class FileRequest { public: - FileRequest(ByteString path, Function)> on_file_request_finish); + FileRequest(ByteString path, ESCAPING Function)> on_file_request_finish); ByteString path() const; diff --git a/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h b/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h index 6101a1728f8..6bf58719446 100644 --- a/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h +++ b/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h @@ -20,7 +20,7 @@ public: virtual ~EventLoopPlugin(); virtual void spin_until(JS::SafeFunction goal_condition) = 0; - virtual void deferred_invoke(JS::SafeFunction) = 0; + virtual void deferred_invoke(ESCAPING JS::SafeFunction) = 0; virtual NonnullRefPtr create_timer() = 0; virtual void quit() = 0; }; diff --git a/Userland/Libraries/LibWeb/Platform/ImageCodecPlugin.h b/Userland/Libraries/LibWeb/Platform/ImageCodecPlugin.h index 477915d486c..b2ba33ea6c3 100644 --- a/Userland/Libraries/LibWeb/Platform/ImageCodecPlugin.h +++ b/Userland/Libraries/LibWeb/Platform/ImageCodecPlugin.h @@ -32,7 +32,7 @@ public: virtual ~ImageCodecPlugin(); - virtual NonnullRefPtr> decode_image(ReadonlyBytes, Function(DecodedImage&)> on_resolved, Function on_rejected) = 0; + virtual NonnullRefPtr> decode_image(ReadonlyBytes, ESCAPING Function(DecodedImage&)> on_resolved, ESCAPING Function on_rejected) = 0; }; } diff --git a/Userland/Services/EchoServer/main.cpp b/Userland/Services/EchoServer/main.cpp index 7bd22eadc69..fd86c998bab 100644 --- a/Userland/Services/EchoServer/main.cpp +++ b/Userland/Services/EchoServer/main.cpp @@ -34,7 +34,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto server = TRY(Core::TCPServer::try_create()); TRY(server->listen({}, port)); - HashMap> clients; + IGNORE_USE_IN_ESCAPING_LAMBDA HashMap> clients; int next_id = 0; server->on_ready_to_accept = [&next_id, &clients, &server] { diff --git a/Userland/Services/TelnetServer/main.cpp b/Userland/Services/TelnetServer/main.cpp index 379bc43ca55..c9beb12e85c 100644 --- a/Userland/Services/TelnetServer/main.cpp +++ b/Userland/Services/TelnetServer/main.cpp @@ -102,7 +102,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto server = TRY(Core::TCPServer::try_create()); TRY(server->listen({}, port)); - HashMap> clients; + IGNORE_USE_IN_ESCAPING_LAMBDA HashMap> clients; int next_id = 0; server->on_ready_to_accept = [&next_id, &clients, &server, command] { diff --git a/Userland/Services/WebContent/ImageCodecPluginSerenity.h b/Userland/Services/WebContent/ImageCodecPluginSerenity.h index c065234cefb..a5e6c43adce 100644 --- a/Userland/Services/WebContent/ImageCodecPluginSerenity.h +++ b/Userland/Services/WebContent/ImageCodecPluginSerenity.h @@ -21,7 +21,7 @@ public: ImageCodecPluginSerenity(); virtual ~ImageCodecPluginSerenity() override; - virtual NonnullRefPtr> decode_image(ReadonlyBytes, Function(Web::Platform::DecodedImage&)> on_resolved, Function on_rejected) override; + virtual NonnullRefPtr> decode_image(ReadonlyBytes, ESCAPING Function(Web::Platform::DecodedImage&)> on_resolved, ESCAPING Function on_rejected) override; private: RefPtr m_client; diff --git a/Userland/Utilities/test-pthread.cpp b/Userland/Utilities/test-pthread.cpp index 77fc3ec56b3..1f24913564a 100644 --- a/Userland/Utilities/test-pthread.cpp +++ b/Userland/Utilities/test-pthread.cpp @@ -18,7 +18,7 @@ static ErrorOr test_once() static Vector v; v.clear(); - pthread_once_t once = PTHREAD_ONCE_INIT; + IGNORE_USE_IN_ESCAPING_LAMBDA pthread_once_t once = PTHREAD_ONCE_INIT; Vector, threads_count> threads; for (size_t i = 0; i < threads_count; i++) { @@ -44,9 +44,9 @@ static ErrorOr test_mutex() constexpr size_t threads_count = 10; constexpr size_t num_times = 100; - Vector v; + IGNORE_USE_IN_ESCAPING_LAMBDA Vector v; Vector, 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 test_semaphore_as_lock() constexpr size_t threads_count = 10; constexpr size_t num_times = 100; - Vector v; + IGNORE_USE_IN_ESCAPING_LAMBDA Vector v; Vector, 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 test_semaphore_as_lock() static ErrorOr test_semaphore_as_event() { - Vector v; - sem_t semaphore; + IGNORE_USE_IN_ESCAPING_LAMBDA Vector 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 test_semaphore_nonbinary() constexpr size_t num_times = 100; Vector, threads_count> threads; - sem_t semaphore; + IGNORE_USE_IN_ESCAPING_LAMBDA sem_t semaphore; sem_init(&semaphore, 0, num); - Atomic value = 0; - Atomic seen_more_than_two = false; + IGNORE_USE_IN_ESCAPING_LAMBDA Atomic value = 0; + IGNORE_USE_IN_ESCAPING_LAMBDA Atomic seen_more_than_two = false; for (size_t i = 0; i < threads_count; i++) { threads.unchecked_append(TRY(Threading::Thread::try_create([&] {