summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-03-01 19:43:07 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-03-01 19:43:07 +0100
commit7a08e4d2a9178b6cc7b0052d3082895c6a926a6f (patch)
treed7c54070c32cf209eb9b65a72b80feeda66d05be /src/mainview.cpp
parentQ --> K (diff)
downloadrekonq-7a08e4d2a9178b6cc7b0052d3082895c6a926a6f.tar.xz
This changes fixes a crash that can occur on fast closing a lot of tabs.
It anyway changes a bit the behavior in that situation, running to set as current the first tab (That FOR SURE will NOT be deleted)
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 4ab7a8a3..bf99010e 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -129,13 +129,19 @@ TabBar *MainView::tabBar() const
UrlBar *MainView::currentUrlBar() const
{
- return webTab(currentIndex())->urlBar();
+ return currentWebTab()->urlBar();
}
WebTab *MainView::currentWebTab() const
{
- return webTab(currentIndex());
+ int i = currentIndex();
+ WebTab *b = webTab(i);
+ if(b)
+ return b;
+
+ kDebug() << "We failed to find the current tab!!! Let's go sure with the first one...";
+ return webTab(0);
}
@@ -229,10 +235,10 @@ void MainView::currentChanged(int index)
WebTab *tab = this->webTab(index);
if (!tab)
return;
-
+
// retrieve the old webview (that where we move from)
WebTab *oldTab = this->webTab(m_currentTabIndex);
-
+
// set current index
m_currentTabIndex = index;