┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2014-08-12 09:08:30 +0200
committerFrank Reininghaus <[email protected]>2014-08-12 09:08:30 +0200
commit4ed068fffff2343cc0dcd236c38832b7662f8d78 (patch)
treea0918bf1c4e0cf8191f59619dab301a3f4e67b63 /src
parent013b2346f56e846009dd1eebfc88c737d94dad0f (diff)
Fix crash when restoring a session stored with Dolphin 4.13 or earlier
Since DolphinTabPage::saveState() and DolphinTabPage::restoreState(const QByteArray& state) save and restore the state of each tab in a different format than DolphinMainWindow did before the refactoring, we can run into problems: the first time a user logs into a session that has Dolphin 4.14, Dolphin might read session data that does not contain the QByteArray that DolphinTabPage wants to read the data from. In restoreState, isSplitViewEnabled will thus have the value false, and no secondary view will be created. Later on, m_primaryViewActive will also be set to false, but the else branch of the following "if (m_primaryViewActive)" then tries to activate the secondary view, which does not exist -> we get a crash. The easiest solution is to not restore the tab state if no session data in the new format is found. BUG: 338187 REVIEW: 119718 FIXED-IN: 4.14.0
Diffstat (limited to 'src')
-rw-r--r--src/dolphintabpage.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp
index 82be6d59c..4c49869f7 100644
--- a/src/dolphintabpage.cpp
+++ b/src/dolphintabpage.cpp
@@ -187,6 +187,10 @@ QByteArray DolphinTabPage::saveState() const
void DolphinTabPage::restoreState(const QByteArray& state)
{
+ if (state.isEmpty()) {
+ return;
+ }
+
QByteArray sd = state;
QDataStream stream(&sd, QIODevice::ReadOnly);