loolwsd/MessageQueue.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
New commits: commit 0b488905f9f8500268054389f4ac3cee71219d00 Author: Miklos Vajna <[email protected]> Date: Fri Sep 23 09:04:16 2016 +0200 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 diff --git a/loolwsd/MessageQueue.cpp b/loolwsd/MessageQueue.cpp index 75d6441..459098f 100644 --- a/loolwsd/MessageQueue.cpp +++ b/loolwsd/MessageQueue.cpp @@ -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; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
