1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

ClipboardHistory: Cap the history at 20 entries for now

Now that we can copy bitmaps, we need some kind of cap here or memory
usage quickly skyrockets.

This could probably be improved or made adaptive somehow, this is just
a simple hard cap for now.
This commit is contained in:
Andreas Kling 2020-09-05 16:59:43 +02:00
parent f405cd3830
commit b8d73e259c
2 changed files with 3 additions and 0 deletions

View file

@ -71,6 +71,8 @@ void ClipboardHistoryModel::update()
void ClipboardHistoryModel::add_item(const GUI::Clipboard::DataAndType& item)
{
if (m_history_items.size() == m_history_limit)
m_history_items.take_last();
m_history_items.prepend(item);
update();
}