┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphintabwidget.cpp
diff options
context:
space:
mode:
authorGleb Kasachou <[email protected]>2025-08-20 13:04:43 +0300
committerMéven Car <[email protected]>2025-08-26 09:31:44 +0000
commit60cc39930f1b0a78280712c8fe1447e919f018f8 (patch)
treeaabaa08fa19db28768fbd8a595fd81caa87fb2fe /src/dolphintabwidget.cpp
parent24d859cf19e90fa22ed687b36a68231625c1bd80 (diff)
DolphinTabWidget: Fix segfault when restoring session
When a session is being restored, DolphinTabPage::setSplitViewEnabled() is called for each tab. That function assumes the tab page's m_navigatorsWidget is a valid pointer, which is true only for an active tab. That causes a segmentation fault when Dolphin is launched from the command line with more than two URLs and the --split flag. This commit fixes this bug by connecting the DolphinNavigatorsWidgetAction to each tab page before calling restoreState() in DolphinTabWidget::readProperties(). BUG: 462046
Diffstat (limited to 'src/dolphintabwidget.cpp')
-rw-r--r--src/dolphintabwidget.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp
index b2f838a40..49e84ad3f 100644
--- a/src/dolphintabwidget.cpp
+++ b/src/dolphintabwidget.cpp
@@ -90,13 +90,20 @@ void DolphinTabWidget::saveProperties(KConfigGroup &group) const
void DolphinTabWidget::readProperties(const KConfigGroup &group)
{
+ if (m_lastViewedTab) {
+ m_lastViewedTab->disconnectNavigators();
+ m_lastViewedTab = nullptr;
+ }
const int tabCount = group.readEntry("Tab Count", 0);
for (int i = 0; i < tabCount; ++i) {
if (i >= count()) {
openNewActivatedTab();
}
const QByteArray state = group.readEntry("Tab Data " % QString::number(i), QByteArray());
- tabPageAt(i)->restoreState(state);
+ DolphinTabPage *tabPage = tabPageAt(i);
+ tabPage->connectNavigators(m_navigatorsWidget);
+ tabPage->restoreState(state);
+ tabPage->disconnectNavigators();
}
const int index = group.readEntry("Active Tab Index", 0);