Skip to content

Commit

Permalink
server: Z21 ClientKernel fix crash on disconnect
Browse files Browse the repository at this point in the history
See traintastic#53
When disabling communications, kernel object is deleted
but EventLoop callback will run after and access deleted
object through captured 'this'
Temporary fix for this problem is to copy log ID value instead.
  • Loading branch information
gfgit committed Jun 10, 2023
1 parent 2aee47c commit de5f275
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/hardware/protocol/z21/clientkernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ void ClientKernel::receive(const Message& message)
{
if(m_config.debugLogRXTX)
EventLoop::call(
[this, msg=toString(message)]()
[logId=m_logId, msg=toString(message)]()
{
Log::log(m_logId, LogMessage::D2002_RX_X, msg);
Log::log(logId, LogMessage::D2002_RX_X, msg);
});

switch(message.header())
Expand Down

0 comments on commit de5f275

Please sign in to comment.