1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

ClosedWindowsManager: Only save last 3 windows in session file

Prevents growing session file indefinitely.
This commit is contained in:
David Rosca 2018-01-04 17:58:27 +01:00
parent d1d99e3b71
commit 54282af88f

View File

@ -106,10 +106,13 @@ QByteArray ClosedWindowsManager::saveState() const
QDataStream stream(&data, QIODevice::WriteOnly);
stream << closedWindowsVersion;
stream << m_closedWindows.count();
for (const Window &window : qAsConst(m_closedWindows)) {
stream << window.windowState;
// Only save last 3 windows
const int windowCount = qBound(0, m_closedWindows.count(), 3);
stream << windowCount;
for (int i = 0; i < windowCount; ++i) {
stream << m_closedWindows.at(i).windowState;
}
return data;