Fix crash on program exit. Always good to use defensive programming techniques...

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@225 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi 2010-02-26 08:53:10 +00:00
parent 4978460d4c
commit 64f8c06735

View File

@ -353,13 +353,22 @@ void LauncherWindow::MessageReceived(BMessage* message)
}
case TAB_CHANGED: {
int32 index = message->FindInt32("index");
SetCurrentWebView(dynamic_cast<BWebView*>(m_tabView->ViewForTab(index)));
updateTitle(m_tabView->TabAt(index)->Label());
m_url->SetText(CurrentWebView()->MainFrameURL());
// Trigger update of the interface to the new page, by requesting
// to resend all notifications.
CurrentWebView()->WebPage()->ResendNotifications();
// This message may be received also when the last tab closed, i.e. with index == -1.
int32 index = -1;
message->FindInt32("index", &index);
BWebView* webView = dynamic_cast<BWebView*>(m_tabView->ViewForTab(index));
SetCurrentWebView(webView);
BTab* tab = m_tabView->TabAt(index);
if (tab)
updateTitle(tab->Label());
else
updateTitle("");
if (webView) {
m_url->SetText(webView->MainFrameURL());
// Trigger update of the interface to the new page, by requesting
// to resend all notifications.
webView->WebPage()->ResendNotifications();
}
break;
}