From 64dc7f5d73a61799b885d6f274a167bb87f15fab Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 22 Jun 2019 13:04:31 +0200 Subject: [PATCH] Fix a bug with messages jumping if you were scrolled up The bug appeared every 100 messages (so whenever a chunk was deleted) To fix this, we only perform the first chunk offset increment if the item we deleted was not the last item in a chunk --- src/messages/LimitedQueue.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/messages/LimitedQueue.hpp b/src/messages/LimitedQueue.hpp index 2ed68fb47..61e8db56f 100644 --- a/src/messages/LimitedQueue.hpp +++ b/src/messages/LimitedQueue.hpp @@ -253,8 +253,6 @@ private: deleted = this->chunks_->front()->at(this->firstChunkOffset_); - this->firstChunkOffset_++; - // need to delete the first chunk if (this->firstChunkOffset_ == this->chunks_->front()->size() - 1) { @@ -275,6 +273,11 @@ private: this->chunks_ = newVector; this->firstChunkOffset_ = 0; } + else + { + this->firstChunkOffset_++; + } + return true; }