1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

[Fix:] Crash when opening js dialog from locationbar and closing tab

- how to reproduce:
  1. write javascript:alert("test"); to locationbar and hit enter
  2. alert will show up
  3. close tab
  4. app will most likely crash
This commit is contained in:
nowrep 2011-12-15 17:43:06 +01:00
parent c78d9f4978
commit 4439a1d57f
5 changed files with 17 additions and 6 deletions

View File

@ -123,7 +123,7 @@ void LocationBar::urlEnter()
}
m_webView->setFocus();
m_webView->load(urlToLoad);
emit loadUrl(urlToLoad);
}
void LocationBar::textEdit()
@ -247,8 +247,10 @@ void LocationBar::dropEvent(QDropEvent* event)
QUrl dropUrl = event->mimeData()->urls().at(0);
if (WebView::isUrlValid(dropUrl)) {
setText(dropUrl.toString());
p_QupZilla->loadAddress(dropUrl);
QLineEdit::focusOutEvent(new QFocusEvent(QFocusEvent::FocusOut));
m_webView->setFocus();
emit loadUrl(dropUrl);
return;
}
}
@ -256,8 +258,10 @@ void LocationBar::dropEvent(QDropEvent* event)
QUrl dropUrl = QUrl(event->mimeData()->text().trimmed());
if (WebView::isUrlValid(dropUrl)) {
setText(dropUrl.toString());
p_QupZilla->loadAddress(dropUrl);
QLineEdit::focusOutEvent(new QFocusEvent(QFocusEvent::FocusOut));
m_webView->setFocus();
emit loadUrl(dropUrl);
return;
}

View File

@ -53,6 +53,9 @@ public:
void setWebView(WebView* view) { m_webView = view; }
signals:
void loadUrl(const QUrl &url);
public slots:
void showUrl(const QUrl &url, bool empty = true);

View File

@ -316,6 +316,7 @@ void TabBar::mouseDoubleClickEvent(QMouseEvent* event)
m_tabWidget->addView(QUrl(), tr("New tab"), TabWidget::NewTab, true);
return;
}
QTabBar::mouseDoubleClickEvent(event);
}
@ -335,5 +336,6 @@ void TabBar::mouseReleaseEvent(QMouseEvent* event)
m_tabWidget->addView(QUrl(), tr("New tab"), TabWidget::NewSelectedTab, true);
return;
}
QTabBar::mouseReleaseEvent(event);
}

View File

@ -47,6 +47,7 @@ WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar)
connect(m_view.data(), SIGNAL(showUrl(QUrl)), m_locationBar.data(), SLOT(showUrl(QUrl)));
connect(m_view.data(), SIGNAL(rssChanged(bool)), m_locationBar.data(), SLOT(showRSSIcon(bool)));
connect(m_view.data()->webPage(), SIGNAL(privacyChanged(bool)), m_locationBar.data(), SLOT(setPrivacy(bool)));
connect(m_locationBar.data(), SIGNAL(loadUrl(QUrl)), m_view.data(), SLOT(load(QUrl)));
}
void WebTab::showNotification(QWidget* notif)

View File

@ -47,7 +47,6 @@ public:
int getLoading() { return m_progress; }
void zoomReset();
void load(const QUrl &url);
QUrl url() const;
QString title() const;
void reload();
@ -80,6 +79,8 @@ signals:
void rssChanged(bool state);
public slots:
void load(const QUrl &url);
void stop();
void back();
void forward();