MessageQueue: it and payload are the same, keep only one of them
It confuses me that 'it' is a reference, while 'payload' is a value, so even if payload is a const value that's never written, it's not OK to change it to a reference, as the underlying memory is released by the in-between erase() call. Change-Id: I05ad0f64e3eeedf847b74a6fadff610fc7469aa1
This commit is contained in:
parent
b6448a8864
commit
0b488905f9
1 changed files with 2 additions and 3 deletions
|
@ -183,7 +183,7 @@ void TileQueue::reprioritize(const CursorPosition& cursorPosition)
|
|||
{
|
||||
for (size_t i = 0; i < _queue.size(); ++i)
|
||||
{
|
||||
auto& it = _queue[i];
|
||||
auto it = _queue[i];
|
||||
const std::string msg(it.data(), it.size());
|
||||
if (msg.compare(0, 5, "tile ") != 0)
|
||||
{
|
||||
|
@ -198,9 +198,8 @@ void TileQueue::reprioritize(const CursorPosition& cursorPosition)
|
|||
{
|
||||
// Bump to top.
|
||||
Log::trace() << "Bumping tile to top: " << msg << Log::end;
|
||||
const Payload payload = it;
|
||||
_queue.erase(_queue.begin() + i);
|
||||
_queue.push_front(payload);
|
||||
_queue.push_front(it);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue