mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:45:06 +00:00
Kernel: Change polarity of weak ownership between Inode and LocalSocket
There was a bug in which bound Inodes would lose all their references
(because localsocket does not reference them), and they would be
deallocated, and clients would get ECONNREFUSED as a result. now
LocalSocket has a strong reference to inode so that the inode will live
as long as the socket, and Inode has a weak reference to the socket,
because if the socket stops being referenced anywhere it should not be
bound.
This still prevents the reference loop that
220b7dd779
was trying to fix.
This commit is contained in:
parent
2808b03764
commit
ae5d7f542c
4 changed files with 5 additions and 6 deletions
|
@ -143,7 +143,7 @@ ErrorOr<void> Inode::set_shared_vmobject(Memory::SharedInodeVMObject& vmobject)
|
|||
|
||||
LockRefPtr<LocalSocket> Inode::bound_socket() const
|
||||
{
|
||||
return m_bound_socket;
|
||||
return m_bound_socket.strong_ref();
|
||||
}
|
||||
|
||||
bool Inode::bind_socket(LocalSocket& socket)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue