From bd20879e3bbb42fc3a11ec90ba67db32b9b62f6d Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Tue, 23 Dec 2025 11:02:05 +0100 Subject: dolphintabbpage: Allow migration for users with the old session file format Commit 8d44699f introduced a new session file format, without providing a migration path for the old file format, which led to users losing their session. Besides adding the migration path, the condition check for future updates is necessary, since we don't provide guarantees for backwards-compatible format changes. In case users downgrade their Dolphin version/immutable distro or they share the Dolphin config file across multiple systems, Dolphin at least won't crash when reading a session file with a newer format. BUG: 513466 --- src/dolphintabpage.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index 8373d17b8..ce091cfc1 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -336,7 +336,7 @@ void DolphinTabPage::restoreState(const QByteArray &state) // Read the version number of the tab state and check if the version is supported. quint32 version = 0; stream >> version; - if (version != 3) { + if (version < 2 || version > 3) { // The version of the tab state isn't supported, we can't restore it. return; } @@ -374,7 +374,9 @@ void DolphinTabPage::restoreState(const QByteArray &state) QByteArray splitterState; stream >> splitterState; m_splitter->restoreState(splitterState); - stream >> m_splitterLastPosition; + if (version >= 3) { + stream >> m_splitterLastPosition; + } if (!stream.atEnd()) { QString tabTitle; -- cgit v1.3