fix: stop portal input capture thread on server exit

Server aborted with "pure virtual method called" when the bind address
was in use: EiScreen's PortalInputCapture glib thread outlived Arch and
hit its freed vtable. ~EiScreen never deleted m_portalInputCapture, and
a fatal startup threw past cleanupServer(). Fix both.
This commit is contained in:
Nick Bolton 2026-07-08 09:37:47 +01:00 committed by Chris Rizzitello
parent c8231208c1
commit f0f3428d50
2 changed files with 11 additions and 1 deletions

View file

@ -516,7 +516,16 @@ int ServerApp::mainLoop()
} }
// start server, etc // start server, etc
try {
appUtil().startNode(); appUtil().startNode();
} catch (...) {
// a fatal startup failure (e.g. the listen address is already in use)
// exits by throwing, which unwinds past the cleanup at the end of this
// function. tear the server down here so the screen and its worker
// threads don't outlive the app and call into freed globals on exit.
cleanupServer();
throw;
}
// handle hangup signal by reloading the server's configuration // handle hangup signal by reloading the server's configuration
ARCH->setSignalHandler(Arch::ThreadSignal::Hangup, &reloadSignalHandler, nullptr); ARCH->setSignalHandler(Arch::ThreadSignal::Hangup, &reloadSignalHandler, nullptr);

View file

@ -94,6 +94,7 @@ EiScreen::~EiScreen()
delete m_clipboard; delete m_clipboard;
delete m_portalRemoteDesktop; delete m_portalRemoteDesktop;
delete m_portalInputCapture;
} }
void EiScreen::eiLogEvent(ei_log_priority priority, const char *message) const void EiScreen::eiLogEvent(ei_log_priority priority, const char *message) const