overlays: properly remove outdated messages from the queue.

Fixes zombie item glitch if a newer message has shorter duration than the older message
This commit is contained in:
Megamouse 2023-03-02 14:06:42 +01:00
parent 2d4e02f277
commit 6fe41870ab
2 changed files with 12 additions and 5 deletions

View File

@ -132,9 +132,16 @@ namespace rsx
{
const u64 cur_time = rsx::uclock();
while (!vis_set.empty() && vis_set.front().get_expiration() < cur_time)
for (auto it = vis_set.begin(); it != vis_set.end();)
{
vis_set.pop_front();
if (it->get_expiration() < cur_time)
{
it = vis_set.erase(it);
}
else
{
it++;
}
}
while (vis_set.size() < max_visible_items && !ready_set.empty())

View File

@ -37,9 +37,9 @@ namespace rsx
u64 m_expiration_time = 0;
u64 m_visible_duration = 0;
std::shared_ptr<atomic_t<u32>> m_refs;
bool m_processed = false;
usz m_cur_pos = umax;
const u16 m_margin = 6;
bool m_processed = false;
usz m_cur_pos = umax;
static constexpr u16 m_margin = 6;
};
class message final : public overlay