# HG changeset patch # User unC0Rr # Date 1542892075 -3600 # Node ID 61bc44de2b4c90f4346e6de519f8faf98d6520a3 # Parent 0ae9885e153558669794efe48937efc3f32d94bb It was bad idea to store QByteArray referencing memory on stack diff -r 0ae9885e1535 -r 61bc44de2b4c qmlfrontend/game_config.cpp --- a/qmlfrontend/game_config.cpp Thu Nov 22 13:52:00 2018 +0100 +++ b/qmlfrontend/game_config.cpp Thu Nov 22 14:07:55 2018 +0100 @@ -58,18 +58,18 @@ void GameConfig::cfgAppend(const QByteArray& cmd) { Q_ASSERT(cmd.size() <= 49215); + QByteArray sizeBytes; if (cmd.size() < 64) { quint8 len = static_cast(cmd.size()); - m_cfg.append( - QByteArray::fromRawData(reinterpret_cast(&len), 1)); + sizeBytes = QByteArray::fromRawData(reinterpret_cast(&len), 1); } else { quint16 size = static_cast(cmd.size()) - 64; size = (size / 256 + 64) * 256 + size & 0xff; quint16 size_be = qToBigEndian(size); - m_cfg.append( - QByteArray::fromRawData(reinterpret_cast(&size_be), 2)); + sizeBytes = + QByteArray::fromRawData(reinterpret_cast(&size_be), 2); } - m_cfg.append(cmd); + m_cfg.append(sizeBytes + cmd); }