From 4486a6b801e9ee50c189550db533371182651bf2 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 17 Jan 2012 10:40:21 +0100 Subject: Check if action senders exist before using them BUG:281546 --- src/mainview.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/mainview.cpp b/src/mainview.cpp index d008b277..c7cfce0c 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -365,6 +365,9 @@ void MainView::reloadAllTabs() void MainView::windowCloseRequested() { WebPage *page = qobject_cast(sender()); + if (!page) + return; + WebView *view = qobject_cast(page->view()); int index = indexOf(view->parentWidget()); @@ -505,6 +508,9 @@ void MainView::closeTab(int index, bool del) void MainView::webViewLoadStarted() { WebView *view = qobject_cast(sender()); + if (!view) + return; + int index = indexOf(view->parentWidget()); if (-1 != index) { @@ -562,6 +568,9 @@ void MainView::webViewLoadFinished(bool ok) void MainView::webViewIconChanged() { WebView *view = qobject_cast(sender()); + if (!view) + return; + WebTab *tab = qobject_cast(view->parent()); const int index = indexOf(tab); @@ -584,11 +593,15 @@ void MainView::webViewTitleChanged(const QString &title) tabTitle.replace('&', "&&"); WebTab *tab = qobject_cast(sender()); + if (!tab) + return; + int index = indexOf(tab); if (-1 != index) { setTabText(index, tabTitle); } + if (currentIndex() == index) { emit currentTitle(viewTitle); @@ -598,6 +611,7 @@ void MainView::webViewTitleChanged(const QString &title) if (tabTitle != i18n("(Untitled)")) tabBar()->setTabHighlighted(index); } + rApp->historyManager()->updateHistoryEntry(tab->url(), tabTitle); if (ReKonfig::hoveringTabOption() == 1) tabBar()->setTabToolTip(index, tabTitle.remove('&')); @@ -607,6 +621,9 @@ void MainView::webViewTitleChanged(const QString &title) void MainView::webViewUrlChanged(const QUrl &url) { WebView *view = qobject_cast(sender()); + if (!view) + return; + int index = indexOf(view->parentWidget()); if (ReKonfig::hoveringTabOption() == 2) tabBar()->setTabToolTip(index, url.toString()); -- cgit v1.2.1