mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:47:34 +00:00
Ladybird: Store the WebContent QSocketNotifier on the stack
This was being heap allocated with naked-new and never freed. Caught by AddressSanitizer.
This commit is contained in:
parent
ac80475a1f
commit
9fd54e1f90
2 changed files with 7 additions and 5 deletions
|
@ -49,7 +49,6 @@
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QSocketNotifier>
|
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolTip>
|
#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)));
|
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)));
|
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);
|
m_web_content_notifier.setSocket(new_client->socket().fd().value());
|
||||||
QObject::connect(notifier, &QSocketNotifier::activated, [new_client = new_client.ptr()] {
|
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())
|
if (auto notifier = new_client->socket().notifier())
|
||||||
notifier->on_ready_to_read();
|
notifier->on_ready_to_read();
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
#include <LibGfx/StandardCursor.h>
|
#include <LibGfx/StandardCursor.h>
|
||||||
#include <LibWeb/CSS/PreferredColorScheme.h>
|
#include <LibWeb/CSS/PreferredColorScheme.h>
|
||||||
#include <LibWeb/CSS/Selector.h>
|
#include <LibWeb/CSS/Selector.h>
|
||||||
#include <LibWebView/ViewImplementation.h>
|
|
||||||
|
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
|
#include <LibWebView/ViewImplementation.h>
|
||||||
#include <QAbstractScrollArea>
|
#include <QAbstractScrollArea>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QSocketNotifier>
|
||||||
|
|
||||||
class QTextEdit;
|
class QTextEdit;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
@ -196,6 +196,7 @@ private:
|
||||||
Gfx::IntRect m_viewport_rect;
|
Gfx::IntRect m_viewport_rect;
|
||||||
|
|
||||||
void handle_web_content_process_crash();
|
void handle_web_content_process_crash();
|
||||||
|
QSocketNotifier m_web_content_notifier { QSocketNotifier::Type::Read };
|
||||||
|
|
||||||
RefPtr<Gfx::Bitmap> m_backup_bitmap;
|
RefPtr<Gfx::Bitmap> m_backup_bitmap;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue