summaryrefslogtreecommitdiff
path: root/Ladybird/WebContentView.cpp
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-31 08:45:11 -0500
committerLinus Groh <mail@linusgroh.de>2023-02-01 14:04:44 +0000
commit9fd54e1f90e74d1849ba34a4368460d384b649ae (patch)
tree36ca4de7a356eba55d7793084ced955847bcc99b /Ladybird/WebContentView.cpp
parentac80475a1f67b4147e147c331d114e36575fda4b (diff)
downloadserenity-9fd54e1f90e74d1849ba34a4368460d384b649ae.zip
Ladybird: Store the WebContent QSocketNotifier on the stack
This was being heap allocated with naked-new and never freed. Caught by AddressSanitizer.
Diffstat (limited to 'Ladybird/WebContentView.cpp')
-rw-r--r--Ladybird/WebContentView.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Ladybird/WebContentView.cpp b/Ladybird/WebContentView.cpp
index 3dee9df3f1..1c2af12c2b 100644
--- a/Ladybird/WebContentView.cpp
+++ b/Ladybird/WebContentView.cpp
@@ -49,7 +49,6 @@
#include <QPaintEvent>
#include <QPainter>
#include <QScrollBar>
-#include <QSocketNotifier>
#include <QTextEdit>
#include <QTimer>
#include <QToolTip>
@@ -607,8 +606,10 @@ void WebContentView::create_client()
auto new_client = MUST(adopt_nonnull_ref_or_enomem(new (nothrow) WebView::WebContentClient(std::move(socket), *this)));
new_client->set_fd_passing_socket(MUST(Core::Stream::LocalSocket::adopt_fd(ui_fd_passing_fd)));
- auto* notifier = new QSocketNotifier(new_client->socket().fd().value(), QSocketNotifier::Type::Read);
- QObject::connect(notifier, &QSocketNotifier::activated, [new_client = new_client.ptr()] {
+ m_web_content_notifier.setSocket(new_client->socket().fd().value());
+ m_web_content_notifier.setEnabled(true);
+
+ QObject::connect(&m_web_content_notifier, &QSocketNotifier::activated, [new_client = new_client.ptr()] {
if (auto notifier = new_client->socket().notifier())
notifier->on_ready_to_read();
});