]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix crash when restoring a session stored with Dolphin 4.13 or earlier
authorFrank Reininghaus <frank78ac@googlemail.com>
Tue, 12 Aug 2014 07:08:30 +0000 (09:08 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Tue, 12 Aug 2014 07:08:30 +0000 (09:08 +0200)
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

src/dolphintabpage.cpp

index 82be6d59c108bc715250940230b36d8151c1e6e0..4c49869f77e07d4341b76d450f827ae73199b108 100644 (file)
@@ -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);