mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 21:12:26 +00:00
LibIPC: Do not try to send a response back if transport was closed
The local handling of some messages might cause the transport to get closed. If that's the case, we shouldn't try to send back a response. This fixes many of the "Trying to post_message during IPC shutdown" errors I was seeing when terminating Ladybird or when abnormally exiting from LibWeb tests.
This commit is contained in:
parent
9e4b6c1ded
commit
63119355e3
Notes:
github-actions[bot]
2025-08-18 00:53:17 +00:00
Author: https://github.com/gmta
Commit: 63119355e3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5891
Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 14 additions and 11 deletions
|
@ -71,18 +71,21 @@ void ConnectionBase::handle_messages()
|
||||||
{
|
{
|
||||||
auto messages = move(m_unprocessed_messages);
|
auto messages = move(m_unprocessed_messages);
|
||||||
for (auto& message : messages) {
|
for (auto& message : messages) {
|
||||||
if (message->endpoint_magic() == m_local_endpoint_magic) {
|
if (message->endpoint_magic() != m_local_endpoint_magic)
|
||||||
auto handler_result = m_local_stub.handle(move(message));
|
continue;
|
||||||
if (handler_result.is_error()) {
|
|
||||||
dbgln("IPC::ConnectionBase::handle_messages: {}", handler_result.error());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (auto response = handler_result.release_value()) {
|
auto handler_result = m_local_stub.handle(move(message));
|
||||||
if (auto post_result = post_message(*response); post_result.is_error()) {
|
if (handler_result.is_error()) {
|
||||||
dbgln("IPC::ConnectionBase::handle_messages: {}", post_result.error());
|
dbgln("IPC::ConnectionBase::handle_messages: {}", handler_result.error());
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_open())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (auto response = handler_result.release_value()) {
|
||||||
|
if (auto post_result = post_message(*response); post_result.is_error())
|
||||||
|
dbgln("IPC::ConnectionBase::handle_messages: {}", post_result.error());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue