From 406b9363222b797a5f94dba7c33d2cf638414666 Mon Sep 17 00:00:00 2001 From: stippi Date: Wed, 7 Apr 2010 13:07:44 +0000 Subject: [PATCH] Selecting the tab for which authentication was requested didn't work anymore. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@401 94f232f2-1747-11df-bad5-a5bfde151594 --- src/apps/webpositive/BrowserWindow.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp index b9ef820438..f41760328d 100644 --- a/src/apps/webpositive/BrowserWindow.cpp +++ b/src/apps/webpositive/BrowserWindow.cpp @@ -1168,7 +1168,13 @@ BrowserWindow::AuthenticationChallenge(BString message, BString& inOutUser, { // Switch to the page for which this authentication is required. if (view != CurrentWebView()) { - fTabManager->SelectTab(view); + int32 tabIndex = fTabManager->TabForView(view); + if (tabIndex < 0) { + // page seems to be gone already? + return false; + } + fTabManager->SelectTab(tabIndex); + _TabChanged(tabIndex); UpdateIfNeeded(); } AuthenticationPanel* panel = new AuthenticationPanel(Frame()); @@ -1210,7 +1216,7 @@ BrowserWindow::_ShutdownTab(int32 index) { BView* view = fTabManager->RemoveTab(index); BWebView* webView = dynamic_cast(view); - if (webView) + if (webView != NULL) webView->Shutdown(); else delete view; @@ -1229,12 +1235,12 @@ BrowserWindow::_TabChanged(int32 index) SetCurrentWebView(webView); - if (webView) { + if (webView != NULL) { _UpdateTitle(webView->MainFrameTitle()); PageUserData* userData = static_cast( webView->GetUserData()); - if (userData && userData->FocusedView() != NULL) + if (userData != NULL && userData->FocusedView() != NULL) userData->FocusedView()->MakeFocus(true); else webView->MakeFocus(true);