terminal: Use proper lambda functions when registering a fd listener for the pseudoterminal

This commit is contained in:
apio 2024-01-19 21:11:03 +01:00
parent 1cd355a8e8
commit 63f785563d
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -35,8 +35,6 @@ static void sigchld_handler(int)
ui::App::the().set_should_close(true);
}
TerminalWidget* s_main = nullptr;
Result<void> TerminalWidget::init(char* const* args)
{
m_font = ui::Font::default_font();
@ -62,17 +60,10 @@ Result<void> TerminalWidget::init(char* const* args)
fcntl(m_pty, F_SETFL, O_NONBLOCK);
// FIXME: Find a better solution for this. What if the caller needs several TerminalWidgets in one app? We can't
// just use a singleton, can we?
os::EventLoop::the().register_fd_listener(m_pty, [](int, int) {
check(s_main);
s_main->process();
});
os::EventLoop::the().register_fd_listener(m_pty, [this](int, int) { this->process(); });
m_child_pid = child;
s_main = this;
return {};
}