From 7a08e4d2a9178b6cc7b0052d3082895c6a926a6f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 1 Mar 2011 19:43:07 +0100 Subject: 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) --- src/mainview.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') 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; -- cgit v1.2.1