1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:17:34 +00:00

LibWeb+WebContent: Do not reference-count file request objects

There is currently a memory leak with these file request objects due to
the callback on_file_request_finish referencing itself in its capture
list. This object does not need to be reference counted or allocated on
the heap. It is only ever stored in a HashMap until a response is
received from the browser, and it is not shared.
This commit is contained in:
Timothy Flynn 2023-01-30 16:35:47 -05:00 committed by Linus Groh
parent 9bb469f324
commit 96f409ec1e
9 changed files with 29 additions and 26 deletions

View file

@ -34,7 +34,7 @@ public:
void initialize_js_console(Badge<PageHost>);
void request_file(NonnullRefPtr<Web::FileRequest>&);
void request_file(Web::FileRequest);
Optional<int> fd() { return socket().fd(); }
@ -117,7 +117,7 @@ private:
OwnPtr<WebContentConsoleClient> m_console_client;
JS::Handle<JS::GlobalObject> m_console_global_object;
HashMap<int, NonnullRefPtr<Web::FileRequest>> m_requested_files {};
HashMap<int, Web::FileRequest> m_requested_files {};
int last_id { 0 };
};