mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibCore: Make sure to disable notifiers when closing a socket
RefPtr<Notifier> doesn't work quite like it appears to, since the notifier is also a "child" of the socket, in Core::Object sense. Thus we have to both remove it from the parent (socket) and drop the additional RefPtr<Notifier> for it to actually go away. A proper fix for this would be to untangle parent-child relashionship from refcounting and inspectability. This fixes use-after-close of client file descriptors in IPC servers.
This commit is contained in:
parent
bb19eb8f23
commit
89004a3a40
Notes:
sideshowbarker
2024-07-19 05:44:58 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/89004a3a40c Pull-request: https://github.com/SerenityOS/serenity/pull/2531
1 changed files with 8 additions and 1 deletions
|
@ -181,7 +181,14 @@ bool Socket::send(const ByteBuffer& data)
|
|||
void Socket::did_update_fd(int fd)
|
||||
{
|
||||
if (fd < 0) {
|
||||
m_read_notifier = nullptr;
|
||||
if (m_read_notifier) {
|
||||
m_read_notifier->remove_from_parent();
|
||||
m_read_notifier = nullptr;
|
||||
}
|
||||
if (m_notifier) {
|
||||
m_notifier->remove_from_parent();
|
||||
m_notifier = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (m_connected) {
|
||||
|
|
Loading…
Reference in a new issue