mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-27 10:07:56 +00:00
Deallocate PTY's when they close.
This required a fair bit of plumbing. The CharacterDevice::close() virtual will now be closed by ~FileDescriptor(), allowing device implementations to do custom cleanup at that point. One big problem remains: if the master PTY is closed before the slave PTY, we go into crashy land.
This commit is contained in:
@@ -15,6 +15,7 @@ SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
|
||||
SlavePTY::~SlavePTY()
|
||||
{
|
||||
DevPtsFS::the().unregister_slave_pty(*this);
|
||||
VFS::the().unregister_character_device(*this);
|
||||
}
|
||||
|
||||
String SlavePTY::tty_name() const
|
||||
@@ -37,3 +38,8 @@ bool SlavePTY::can_write(Process&) const
|
||||
{
|
||||
return m_master.can_write_from_slave();
|
||||
}
|
||||
|
||||
void SlavePTY::close()
|
||||
{
|
||||
m_master.notify_slave_closed(Badge<SlavePTY>());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user