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

[Fix] crash in Click2Flash plugin when element is not found.

- also little improvement in WebView mousepress events
This commit is contained in:
nowrep 2011-12-28 23:25:40 +01:00
parent 89cad89ad0
commit 5af4df90b7
2 changed files with 11 additions and 3 deletions

View File

@ -171,8 +171,13 @@ void ClickToFlash::findElement()
QPoint objectPos = view->mapFromGlobal(m_toolButton->mapToGlobal(m_toolButton->pos())); QPoint objectPos = view->mapFromGlobal(m_toolButton->mapToGlobal(m_toolButton->pos()));
QWebFrame* objectFrame = view->page()->frameAt(objectPos); QWebFrame* objectFrame = view->page()->frameAt(objectPos);
QWebHitTestResult hitResult = objectFrame->hitTestContent(objectPos); QWebHitTestResult hitResult;
QWebElement hitElement = hitResult.element(); QWebElement hitElement;
if (objectFrame) {
hitResult = objectFrame->hitTestContent(objectPos);
hitElement = hitResult.element();
}
if (!hitElement.isNull()) { if (!hitElement.isNull()) {
m_element = hitElement; m_element = hitElement;

View File

@ -846,10 +846,12 @@ void WebView::mousePressEvent(QMouseEvent* event)
if (isUrlValid(QUrl(m_hoveredLink))) { if (isUrlValid(QUrl(m_hoveredLink))) {
tabWidget()->addView(QUrl::fromEncoded(m_hoveredLink.toUtf8()), tr("New tab"), TabWidget::NewBackgroundTab); tabWidget()->addView(QUrl::fromEncoded(m_hoveredLink.toUtf8()), tr("New tab"), TabWidget::NewBackgroundTab);
event->accept(); event->accept();
return;
} }
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
else { else {
QWebView::mouseDoubleClickEvent(event); QWebView::mouseDoubleClickEvent(event);
return;
} }
#endif #endif
break; break;
@ -859,9 +861,10 @@ void WebView::mousePressEvent(QMouseEvent* event)
return; return;
} }
default: default:
QWebView::mousePressEvent(event);
break; break;
} }
QWebView::mousePressEvent(event);
} }
void WebView::keyPressEvent(QKeyEvent* event) void WebView::keyPressEvent(QKeyEvent* event)